Use wxALPHA_XXX constants instead of 0 and 255

No real changes, just try to improve the code clarity.
This commit is contained in:
Vadim Zeitlin
2019-11-10 17:56:44 +01:00
parent d6d5375fe9
commit c433d3d0fd

View File

@@ -1529,13 +1529,13 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm
// blue. The 32-bit quantities are stored native-endian.
// Pre-multiplied alpha is used.
#if defined (__WXMSW__) || defined(__WXOSX__)
unsigned char alpha = hasAlpha ? p.Alpha() : 255;
unsigned char alpha = hasAlpha ? p.Alpha() : wxALPHA_OPAQUE;
// MSW and OSX bitmap pixel bits are already premultiplied.
*data = (alpha << 24 | p.Red() << 16 | p.Green() << 8 | p.Blue());
#else // !__WXMSW__ , !__WXOSX__
// We always have alpha, but we need to premultiply it.
unsigned char alpha = p.Alpha();
if (alpha == 0)
if (alpha == wxALPHA_TRANSPARENT)
*data = 0;
else
*data = (alpha << 24