From 0522587bcb08d11beca9b828403d76918995f32a Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 29 Aug 2019 18:35:14 +0200 Subject: [PATCH] Fix creating a bitmap representing wxMask When bitmap data are accessed with wxNativePixelData, which is designed to handle RGB bitmaps, Alpha() function cannot be used because in this case alpha component index is set to the default value -1 and actually the blue component of the "preceding" pixel is accessed. Closes #18478. --- src/osx/core/bitmap.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 7ea3fa4626..88e327a64b 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -1697,10 +1697,8 @@ wxBitmap wxMask::GetBitmap() const for (int x = 0; x < m_width; ++x, ++p, ++src) { const unsigned char byte = *src; - p.Alpha() = 0xff; - p.Red() = byte; - p.Green() = byte; - p.Blue() = byte; + wxASSERT( byte == 0 || byte == 0xFF ); + p.Red() = p.Green() = p.Blue() = byte; } p = rowStart; p.OffsetY(data, 1);