Fix conditional-uninitialized warning in a different way
Rather than dummy initializations, reorganize the code so there is no way the variables can appear to be uninitialized
This commit is contained in:
@@ -405,23 +405,18 @@ void wxGtkStyleContext::Bg(wxColour& color, int state) const
|
|||||||
const int i = stride * (cairo_image_surface_get_height(surf) / 2);
|
const int i = stride * (cairo_image_surface_get_height(surf) / 2);
|
||||||
const unsigned* p = reinterpret_cast<const unsigned*>(data + i);
|
const unsigned* p = reinterpret_cast<const unsigned*>(data + i);
|
||||||
const unsigned pixel = *p;
|
const unsigned pixel = *p;
|
||||||
guchar r = 0, g = 0, b = 0, a = 0xff;
|
guchar r, g, b, a = 0xff;
|
||||||
switch (cairo_image_surface_get_format(surf))
|
switch (cairo_image_surface_get_format(surf))
|
||||||
{
|
{
|
||||||
case CAIRO_FORMAT_ARGB32:
|
case CAIRO_FORMAT_ARGB32:
|
||||||
a = guchar(pixel >> 24);
|
a = guchar(pixel >> 24);
|
||||||
|
if (a == 0)
|
||||||
|
break;
|
||||||
wxFALLTHROUGH;
|
wxFALLTHROUGH;
|
||||||
case CAIRO_FORMAT_RGB24:
|
case CAIRO_FORMAT_RGB24:
|
||||||
r = guchar(pixel >> 16);
|
r = guchar(pixel >> 16);
|
||||||
g = guchar(pixel >> 8);
|
g = guchar(pixel >> 8);
|
||||||
b = guchar(pixel);
|
b = guchar(pixel);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
a = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (a != 0)
|
|
||||||
{
|
|
||||||
if (a != 0xff)
|
if (a != 0xff)
|
||||||
{
|
{
|
||||||
// un-premultiply
|
// un-premultiply
|
||||||
@@ -430,6 +425,9 @@ void wxGtkStyleContext::Bg(wxColour& color, int state) const
|
|||||||
b = guchar((b * 0xff) / a);
|
b = guchar((b * 0xff) / a);
|
||||||
}
|
}
|
||||||
color.Set(r, g, b, a);
|
color.Set(r, g, b, a);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user