1
0
Fork 0

- fix alpha handling (hopefully)

- remove another leftover debugging line
This commit is contained in:
mfranz 2005-07-13 06:37:39 +00:00
parent 275a9a5cc0
commit eefd7dee8c
3 changed files with 2 additions and 8 deletions

View file

@ -667,7 +667,6 @@ void
FGDialog::setColor(puObject * object, SGPropertyNode * props, int which) FGDialog::setColor(puObject * object, SGPropertyNode * props, int which)
{ {
string type = props->getName(); string type = props->getName();
string watch = "button";
FGColor c(_gui->getColor("background")); FGColor c(_gui->getColor("background"));
c.merge(_gui->getColor(type)); c.merge(_gui->getColor(type));
c.merge(props->getNode("color")); c.merge(props->getNode("color"));

View file

@ -372,8 +372,6 @@ FGColor::merge(const SGPropertyNode *node)
_blue = n->getFloatValue(), dirty = true; _blue = n->getFloatValue(), dirty = true;
if ((n = node->getNode("alpha"))) if ((n = node->getNode("alpha")))
_alpha = n->getFloatValue(), dirty = true; _alpha = n->getFloatValue(), dirty = true;
else
_alpha = 1.0;
return dirty; return dirty;
} }
@ -389,8 +387,6 @@ FGColor::merge(const FGColor& color)
_blue = color._blue, dirty = true; _blue = color._blue, dirty = true;
if (color._alpha >= 0.0) if (color._alpha >= 0.0)
_alpha = color._alpha, dirty = true; _alpha = color._alpha, dirty = true;
else
_alpha = 1.0;
return dirty; return dirty;
} }

View file

@ -220,8 +220,7 @@ public:
return true; return true;
} }
bool isValid() const { bool isValid() const {
return _red >= 0.0 && _green >= 0.0 && _blue >= 0.0 return _red >= 0.0 && _green >= 0.0 && _blue >= 0.0;
&& _alpha >= 0.0;
} }
void print() const { void print() const {
std::cerr << "red=" << _red << ", green=" << _green std::cerr << "red=" << _red << ", green=" << _green
@ -236,7 +235,7 @@ public:
inline float red() const { return clamp(_red); } inline float red() const { return clamp(_red); }
inline float green() const { return clamp(_green); } inline float green() const { return clamp(_green); }
inline float blue() const { return clamp(_blue); } inline float blue() const { return clamp(_blue); }
inline float alpha() const { return clamp(_alpha); } inline float alpha() const { return _alpha < 0.0 ? 1.0 : clamp(_alpha); }
protected: protected:
float _red, _green, _blue, _alpha; float _red, _green, _blue, _alpha;