wxBitmap with cleared alpha channel doesn't keep its alpha flag any more.

Explicitly reset wxBitmap alpha flag after clearing its alpha channel to
ensure that we don't treat it as having alpha after going to all the trouble
of ensuring that it doesn't/

See #14403.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-01-11 14:24:35 +00:00
parent 60a3e0cc54
commit e484333926
3 changed files with 9 additions and 3 deletions

View File

@@ -168,7 +168,8 @@ public:
// these functions are internal and shouldn't be used, they risk to // these functions are internal and shouldn't be used, they risk to
// disappear in the future // disappear in the future
bool HasAlpha() const; bool HasAlpha() const;
void UseAlpha(); void UseAlpha(bool use = true);
void ResetAlpha() { UseAlpha(false); }
// support for scaled bitmaps // support for scaled bitmaps
virtual double GetScaleFactor() const { return 1.0; } virtual double GetScaleFactor() const { return 1.0; }

View File

@@ -1203,10 +1203,10 @@ wxDC *wxBitmap::GetSelectedInto() const
#endif #endif
} }
void wxBitmap::UseAlpha() void wxBitmap::UseAlpha(bool use)
{ {
if ( GetBitmapData() ) if ( GetBitmapData() )
GetBitmapData()->m_hasAlpha = true; GetBitmapData()->m_hasAlpha = use;
} }
bool wxBitmap::HasAlpha() const bool wxBitmap::HasAlpha() const

View File

@@ -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); dcDst->DoSelect(bmpOld);
} }