Skip to content

Commit cf0fb5a

Browse files
committed
Hacky fix for bizarre Windows crash
1 parent 21910db commit cf0fb5a

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/Core/Datatypes/ColorMap.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include <Core/Math/MiscMath.h>
3131
#include <Core/Datatypes/ColorMap.h>
32+
#include <iostream>
3233

3334
using namespace SCIRun::Core::Datatypes;
3435

@@ -42,7 +43,7 @@ ColorMap::ColorMap(const std::string& name, const size_t resolution, const doubl
4243

4344
ColorMap* ColorMap::clone() const
4445
{
45-
return new ColorMap(name_,resolution_,shift_,invert_);
46+
return new ColorMap(*this);
4647
}
4748

4849
ColorMapHandle StandardColorMapFactory::create(const std::string& name, const size_t &resolution,
@@ -82,7 +83,13 @@ ColorRGB ColorMap::hslToRGB(float h, float s, float l) {
8283
}
8384

8485

85-
float ColorMap::getTransformedColor(float f) {
86+
float ColorMap::getTransformedColor(float f) const {
87+
static bool x = true;
88+
if (x)
89+
{
90+
std::cout << "";// this;// << " " << name_ << " " << resolution_ << " " << shift_ << " " << invert_ << std::endl;
91+
x = false;
92+
}
8693
//@todo this will not be needed with rescale color map.
8794
float v = std::min(std::max(0.f,f),1.f);
8895
double shift = shift_;
@@ -103,7 +110,7 @@ float ColorMap::getTransformedColor(float f) {
103110
return v;
104111
}
105112

106-
ColorRGB ColorMap::getColorMapVal(float v) {
113+
ColorRGB ColorMap::getColorMapVal(float v) const {
107114
float f = getTransformedColor(v);
108115
//now grab the RGB
109116
ColorRGB col;

src/Core/Datatypes/ColorMap.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,22 @@ namespace Datatypes {
4343
public:
4444
explicit ColorMap(const std::string& name, const size_t resolution = 256,
4545
const double shift = 0.0, const bool invert = false);
46-
4746
virtual ColorMap* clone() const;
4847

4948
std::string getColorMapName() const {return name_;}
5049
size_t getColorMapResolution() const {return resolution_;}
5150
double getColorMapShift() const {return shift_;}
5251
bool getColorMapInvert() const {return invert_;}
53-
Core::Datatypes::ColorRGB getColorMapVal(float v);
54-
float getTransformedColor(float v);
52+
Core::Datatypes::ColorRGB getColorMapVal(float v) const;
53+
float getTransformedColor(float v) const;
5554
private:
5655
std::string name_;
5756
size_t resolution_;
5857
double shift_;
5958
bool invert_;
60-
boost::shared_ptr<class ColorMapImpl> impl_;
61-
float Hue_2_RGB(float v1, float v2, float vH);
62-
Core::Datatypes::ColorRGB hslToRGB(float h, float s, float l);
59+
//boost::shared_ptr<class ColorMapImpl> impl_;
60+
static float Hue_2_RGB(float v1, float v2, float vH);
61+
static Core::Datatypes::ColorRGB hslToRGB(float h, float s, float l);
6362
};
6463

6564
class SCISHARE StandardColorMapFactory : boost::noncopyable

0 commit comments

Comments
 (0)