Fix converting wxBitmap to wxImage

wxBitmap can have both alpha channel and a mask so alpha channel values
should be passed to the target wxImage even if mask exists.

Closes #19010.
This commit is contained in:
Artur Wieczorek
2020-12-14 20:06:35 +01:00
parent 1b18b1ad5c
commit 9bbaab6e56

View File

@@ -1304,12 +1304,13 @@ wxImage wxBitmap::ConvertToImage() const
else if ( r == MASK_RED && g == MASK_GREEN && b == MASK_BLUE )
b = MASK_BLUE_REPLACEMENT ;
}
else if ( hasAlpha )
if ( hasAlpha )
{
*alpha++ = a ;
#if wxOSX_USE_PREMULTIPLIED_ALPHA
// this must be non-premultiplied data
if ( a != 0xFF && a!= 0 )
if ( !hasMask && a != 0xFF && a!= 0 )
{
r = r * 255 / a;
g = g * 255 / a;