diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 218d1d7435..2a32a1df23 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1414,43 +1414,57 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm if ( isSrcBpp32 ) { - // use the bitmap's alpha - wxAlphaPixelData - pixData(bmpSource, wxPoint(0, 0), wxSize(m_width, m_height)); - wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data.")); + // Using wxAlphaPixelData sets (on wxMSW and wxOSX) the internal + // "has alpha" flag but we want to leave it unchanged, so we need + // to save its current value now and restore it afterwards. +#if defined(__WXMSW__) || defined(__WXOSX__) + const bool hasAlpha = bmpSource.HasAlpha(); +#endif // __WXMSW__ || __WXOSX__ - wxAlphaPixelData::Iterator p(pixData); - for (int y=0; y