diff --git a/docs/changes.txt b/docs/changes.txt index 3f5989e26b..7b035c2af8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -619,6 +619,7 @@ wxMSW: - Fix display of bitmaps with alpha in wxStaticBitmap (Artur Wieczorek). - Fix wxClientDC::Clear() for scrolled windows (Artur Wieczorek). - Make wxPrinterDC::DrawIcon() actually work (Artur Wieczorek). +- Fix handling of wxSET, wxCLEAR and wxINVERT in wxDC (Artur Wieczorek). wxOSX: diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index e6c375b364..ed885b8fb2 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -2186,7 +2186,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, return false; } - const HDC hdcSrc = GetHdcOf(*implSrc); + HDC hdcSrc = GetHdcOf(*implSrc); // if either the source or destination has alpha channel, we must use // AlphaBlt() as other function don't handle it correctly @@ -2243,6 +2243,16 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, return false; } + // Most of the operations involve the source or the pattern, but a few of + // them (and only those few, no other are possible) only use destination + // HDC. For them we must not give a valid source HDC to MaskBlt() as it + // still uses it, somehow, and the result is garbage. + if ( dwRop == BLACKNESS || dwRop == WHITENESS || + dwRop == DSTINVERT || dwRop == DSTCOPY ) + { + hdcSrc = NULL; + } + bool success = false; if (useMask)