Fix making a copy of wxBitmap

Because wxBitmap can have both alpha channel and mask, so the presence of the mask shouldn't prevent alpha channel from being enabled (if necessary).
This commit is contained in:
Artur Wieczorek 2019-09-16 20:32:28 +02:00
parent 992b594c15
commit 0818e334fd

View File

@ -160,9 +160,11 @@ wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData &tocopy) : wxGDIRefData()
Init();
Create(tocopy.GetWidth(), tocopy.GetHeight(), tocopy.GetDepth(), tocopy.GetScaleFactor());
// Bitmap can have both mask and alpha channel so we have to copy both form the source.
if (tocopy.m_bitmapMask)
m_bitmapMask = new wxMask(*tocopy.m_bitmapMask);
else if (tocopy.HasAlpha())
if (tocopy.HasAlpha())
UseAlpha(true);
unsigned char* dest = (unsigned char*)GetRawAccess();