Someone forgot to initialize fUpdate15 and fColor15 when adding 15bit color

support some 7 years ago...
CID 10246, 10245, 10244, 9471, 9454 and 9453 all concerning that (in the
different constructors / assignements).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39983 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2010-12-28 15:59:07 +00:00
parent 14a12acc76
commit aa8219391f
+20 -12
View File
@@ -43,7 +43,7 @@
\brief Function for easy conversion of 16-bit colors to 32-bit \brief Function for easy conversion of 16-bit colors to 32-bit
\param col Pointer to an rgb_color. \param col Pointer to an rgb_color.
\param color RGB16 color \param color RGB16 color
This function will do nothing if passed a NULL 32-bit color. This function will do nothing if passed a NULL 32-bit color.
*/ */
void void
@@ -51,9 +51,9 @@ SetRGBColor16(rgb_color *col,uint16 color)
{ {
if(!col) if(!col)
return; return;
uint16 r16,g16,b16; uint16 r16,g16,b16;
// alpha's the easy part // alpha's the easy part
col->alpha=0; col->alpha=0;
@@ -72,7 +72,7 @@ SetRGBColor16(rgb_color *col,uint16 color)
\param palette Array of 256 rgb_color objects \param palette Array of 256 rgb_color objects
\param color Color to match \param color Color to match
\return Index of the closest matching color \return Index of the closest matching color
Note that passing a NULL palette will always return 0 and passing an array of less Note that passing a NULL palette will always return 0 and passing an array of less
than 256 rgb_colors will cause a crash. than 256 rgb_colors will cause a crash.
*/ */
@@ -108,7 +108,7 @@ FindClosestColor(const rgb_color *palette, rgb_color color)
\brief Constructs a RGBA15 color which best matches a given 32-bit color \brief Constructs a RGBA15 color which best matches a given 32-bit color
\param color Color to match \param color Color to match
\return The closest matching color's value \return The closest matching color's value
Format is ARGB, 1:5:5:5 Format is ARGB, 1:5:5:5
*/ */
static uint16 static uint16
@@ -133,7 +133,7 @@ FindClosestColor15(rgb_color color)
\brief Constructs a RGB16 color which best matches a given 32-bit color \brief Constructs a RGB16 color which best matches a given 32-bit color
\param color Color to match \param color Color to match
\return The closest matching color's value \return The closest matching color's value
Format is RGB, 5:6:5 Format is RGB, 5:6:5
*/ */
static uint16 static uint16
@@ -218,8 +218,10 @@ RGBColor::RGBColor(const RGBColor &color)
{ {
fColor32 = color.fColor32; fColor32 = color.fColor32;
fColor16 = color.fColor16; fColor16 = color.fColor16;
fColor15 = color.fColor15;
fColor8 = color.fColor8; fColor8 = color.fColor8;
fUpdate8 = color.fUpdate8; fUpdate8 = color.fUpdate8;
fUpdate15 = color.fUpdate15;
fUpdate16 = color.fUpdate16; fUpdate16 = color.fUpdate16;
} }
@@ -307,7 +309,7 @@ RGBColor::SetColor(uint8 r, uint8 g, uint8 b, uint8 a)
fColor32.blue = b; fColor32.blue = b;
fColor32.alpha = a; fColor32.alpha = a;
fUpdate8 = fUpdate16 = true; fUpdate8 = fUpdate15 = fUpdate16 = true;
} }
@@ -326,7 +328,7 @@ RGBColor::SetColor(int r, int g, int b, int a)
fColor32.blue = (uint8)b; fColor32.blue = (uint8)b;
fColor32.alpha = (uint8)a; fColor32.alpha = (uint8)a;
fUpdate8 = fUpdate16 = true; fUpdate8 = fUpdate15 = fUpdate16 = true;
} }
#if 0 #if 0
@@ -338,9 +340,10 @@ void
RGBColor::SetColor(uint16 col16) RGBColor::SetColor(uint16 col16)
{ {
fColor16 = col16; fColor16 = col16;
SetRGBColor(&fColor32,col16); SetRGBColor(&fColor32, col16);
fUpdate8 = true; fUpdate8 = true;
fUpdate15 = true;
fUpdate16 = false; fUpdate16 = false;
} }
#endif #endif
@@ -355,8 +358,9 @@ RGBColor::SetColor(uint8 col8)
{ {
fColor8 = col8; fColor8 = col8;
fColor32 = SystemPalette()[col8]; fColor32 = SystemPalette()[col8];
fUpdate8 = false; fUpdate8 = false;
fUpdate15 = true;
fUpdate16 = true; fUpdate16 = true;
} }
@@ -369,7 +373,7 @@ void
RGBColor::SetColor(const rgb_color &color) RGBColor::SetColor(const rgb_color &color)
{ {
fColor32 = color; fColor32 = color;
fUpdate8 = fUpdate16 = true; fUpdate8 = fUpdate15 = fUpdate16 = true;
} }
@@ -382,8 +386,10 @@ RGBColor::SetColor(const RGBColor &color)
{ {
fColor32 = color.fColor32; fColor32 = color.fColor32;
fColor16 = color.fColor16; fColor16 = color.fColor16;
fColor15 = color.fColor15;
fColor8 = color.fColor8; fColor8 = color.fColor8;
fUpdate8 = color.fUpdate8; fUpdate8 = color.fUpdate8;
fUpdate15 = color.fUpdate15;
fUpdate16 = color.fUpdate16; fUpdate16 = color.fUpdate16;
} }
@@ -397,8 +403,10 @@ RGBColor::operator=(const RGBColor &color)
{ {
fColor32 = color.fColor32; fColor32 = color.fColor32;
fColor16 = color.fColor16; fColor16 = color.fColor16;
fColor15 = color.fColor15;
fColor8 = color.fColor8; fColor8 = color.fColor8;
fUpdate8 = color.fUpdate8; fUpdate8 = color.fUpdate8;
fUpdate15 = color.fUpdate15;
fUpdate16 = color.fUpdate16; fUpdate16 = color.fUpdate16;
return *this; return *this;
@@ -413,7 +421,7 @@ const RGBColor&
RGBColor::operator=(const rgb_color &color) RGBColor::operator=(const rgb_color &color)
{ {
fColor32 = color; fColor32 = color;
fUpdate8 = fUpdate16 = true; fUpdate8 = fUpdate15 = fUpdate16 = true;
return *this; return *this;
} }