Fix getting a sub-bitmap of wxBitmap with alpha channel and mask
Since wxBitmap can have both alpha channel values and mask we have to use alpha channel (if required) in the sub-bitmap even if the mask is provided too. See #18513.
This commit is contained in:
@@ -936,6 +936,8 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
|
||||
double scale = GetScaleFactor();
|
||||
ret.CreateScaled( rect.width, rect.height, GetDepth(), scale );
|
||||
wxASSERT_MSG( ret.IsOk(), wxT("GetSubBitmap error") );
|
||||
if ( HasAlpha() )
|
||||
ret.UseAlpha() ;
|
||||
|
||||
int destwidth = rect.width*scale ;
|
||||
int destheight = rect.height*scale ;
|
||||
@@ -989,8 +991,6 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
|
||||
mask->OSXCreate( maskbuf , destwidth , destheight , rowBytes );
|
||||
ret.SetMask(mask) ;
|
||||
}
|
||||
else if ( HasAlpha() )
|
||||
ret.UseAlpha() ;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user