From 0818e334fd757d7a751aa7ee7439cd6244e2deff Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 16 Sep 2019 20:32:28 +0200 Subject: [PATCH] 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). --- src/osx/core/bitmap.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 03297f64d9..b2ff394de3 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -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();