fix warnings about passing double as unsigned char
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@55210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -69,7 +69,7 @@ const int BUTTON_DROPDOWN_WIDTH = 10;
|
|||||||
wxBitmap wxAuiBitmapFromBits(const unsigned char bits[], int w, int h,
|
wxBitmap wxAuiBitmapFromBits(const unsigned char bits[], int w, int h,
|
||||||
const wxColour& color);
|
const wxColour& color);
|
||||||
|
|
||||||
double wxAuiBlendColour(double fg, double bg, double alpha);
|
unsigned char wxAuiBlendColour(unsigned char fg, unsigned char bg, double alpha);
|
||||||
wxColor wxAuiStepColour(const wxColor& c, int percent);
|
wxColor wxAuiStepColour(const wxColor& c, int percent);
|
||||||
|
|
||||||
static wxBitmap MakeDisabledBitmap(wxBitmap& bmp)
|
static wxBitmap MakeDisabledBitmap(wxBitmap& bmp)
|
||||||
@@ -98,9 +98,9 @@ static wxBitmap MakeDisabledBitmap(wxBitmap& bmp)
|
|||||||
if (has_mask && *r == mr && *g == mg && *b == mb)
|
if (has_mask && *r == mr && *g == mg && *b == mb)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
*r = (unsigned char)wxAuiBlendColour((double)*r, 255.0, 0.4);
|
*r = wxAuiBlendColour(*r, 255, 0.4);
|
||||||
*g = (unsigned char)wxAuiBlendColour((double)*g, 255.0, 0.4);
|
*g = wxAuiBlendColour(*g, 255, 0.4);
|
||||||
*b = (unsigned char)wxAuiBlendColour((double)*b, 255.0, 0.4);
|
*b = wxAuiBlendColour(*b, 255, 0.4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,9 +159,11 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const wxColour DISABLED_TEXT_COLOR = wxColour(wxAuiBlendColour(0,255,0.4),
|
static const unsigned char
|
||||||
wxAuiBlendColour(0,255,0.4),
|
DISABLED_TEXT_GREY_HUE = wxAuiBlendColour(0, 255, 0.4);
|
||||||
wxAuiBlendColour(0,255,0.4));
|
const wxColour DISABLED_TEXT_COLOR(DISABLED_TEXT_GREY_HUE,
|
||||||
|
DISABLED_TEXT_GREY_HUE,
|
||||||
|
DISABLED_TEXT_GREY_HUE);
|
||||||
|
|
||||||
|
|
||||||
wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt()
|
wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt()
|
||||||
|
@@ -57,14 +57,14 @@
|
|||||||
|
|
||||||
|
|
||||||
// wxAuiBlendColour is used by wxAuiStepColour
|
// wxAuiBlendColour is used by wxAuiStepColour
|
||||||
double wxAuiBlendColour(double fg, double bg, double alpha)
|
unsigned char wxAuiBlendColour(unsigned char fg, unsigned char bg, double alpha)
|
||||||
{
|
{
|
||||||
double result = bg + (alpha * (fg - bg));
|
double result = bg + (alpha * (fg - bg));
|
||||||
if (result < 0.0)
|
if (result < 0.0)
|
||||||
result = 0.0;
|
result = 0.0;
|
||||||
if (result > 255)
|
if (result > 255)
|
||||||
result = 255;
|
result = 255;
|
||||||
return result;
|
return (unsigned char)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wxAuiStepColour() it a utility function that simply darkens
|
// wxAuiStepColour() it a utility function that simply darkens
|
||||||
@@ -76,8 +76,10 @@ wxColor wxAuiStepColour(const wxColor& c, int ialpha)
|
|||||||
if (ialpha == 100)
|
if (ialpha == 100)
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
double r = c.Red(), g = c.Green(), b = c.Blue();
|
unsigned char r = c.Red(),
|
||||||
double bg;
|
g = c.Green(),
|
||||||
|
b = c.Blue();
|
||||||
|
unsigned char bg;
|
||||||
|
|
||||||
// ialpha is 0..200 where 0 is completely black
|
// ialpha is 0..200 where 0 is completely black
|
||||||
// and 200 is completely white and 100 is the same
|
// and 200 is completely white and 100 is the same
|
||||||
@@ -89,21 +91,21 @@ wxColor wxAuiStepColour(const wxColor& c, int ialpha)
|
|||||||
if (ialpha > 100)
|
if (ialpha > 100)
|
||||||
{
|
{
|
||||||
// blend with white
|
// blend with white
|
||||||
bg = 255.0;
|
bg = 255;
|
||||||
alpha = 1.0 - alpha; // 0 = transparent fg; 1 = opaque fg
|
alpha = 1.0 - alpha; // 0 = transparent fg; 1 = opaque fg
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// blend with black
|
// blend with black
|
||||||
bg = 0.0;
|
bg = 0;
|
||||||
alpha = 1.0 + alpha; // 0 = transparent fg; 1 = opaque fg
|
alpha += 1.0; // 0 = transparent fg; 1 = opaque fg
|
||||||
}
|
}
|
||||||
|
|
||||||
r = wxAuiBlendColour(r, bg, alpha);
|
r = wxAuiBlendColour(r, bg, alpha);
|
||||||
g = wxAuiBlendColour(g, bg, alpha);
|
g = wxAuiBlendColour(g, bg, alpha);
|
||||||
b = wxAuiBlendColour(b, bg, alpha);
|
b = wxAuiBlendColour(b, bg, alpha);
|
||||||
|
|
||||||
return wxColour((unsigned char)r, (unsigned char)g, (unsigned char)b);
|
return wxColour(r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user