diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index 4668eaf93f..09f9a85ce3 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -168,7 +168,8 @@ public: // these functions are internal and shouldn't be used, they risk to // disappear in the future bool HasAlpha() const; - void UseAlpha(); + void UseAlpha(bool use = true); + void ResetAlpha() { UseAlpha(false); } // support for scaled bitmaps virtual double GetScaleFactor() const { return 1.0; } diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index cf30c16840..a702165509 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -1203,10 +1203,10 @@ wxDC *wxBitmap::GetSelectedInto() const #endif } -void wxBitmap::UseAlpha() +void wxBitmap::UseAlpha(bool use) { if ( GetBitmapData() ) - GetBitmapData()->m_hasAlpha = true; + GetBitmapData()->m_hasAlpha = use; } bool wxBitmap::HasAlpha() const diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 8df8d87545..891291fd12 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -2718,6 +2718,11 @@ static bool AlphaBlt(wxMSWDCImpl* dcDst, } } + // Using wxAlphaPixelData sets the internal "has alpha" flag + // which is usually what we need, but in this particular case + // we use it to get rid of alpha, not set it, so reset it back. + bmpOld.ResetAlpha(); + dcDst->DoSelect(bmpOld); }