From cf61bbb168eeb7147d9b1d2e298d19b85acadd2c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 19 Oct 2014 12:57:04 +0000 Subject: [PATCH] Use MaskBlt() with the correct ROP when drawing bitmaps with mask. We need to AND the destination with the mask first and then XOR it with the bitmap data to achieve the correct results. Closes #16512. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/dc.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index c6822f1bb1..69d55f19b3 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -1430,11 +1430,16 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool ::RealizePalette(hdcMem); } #endif // wxUSE_PALETTE - + // Apply mask and source bitmap to the destination bitmap + // (note that we have inverted mask). + // AND mask orig.: 0 1 + // AND mask inv.: 1 0 + // dest. bitmap: 0 XOR src dst XOR src + // =src (src=0 => dst unchanged) ok = ::MaskBlt(cdc, x, y, width, height, hdcMem, 0, 0, hbmpMask, 0, 0, - MAKEROP4(SRCCOPY, DSTCOPY)) != 0; + MAKEROP4(SRCCOPY, SRCINVERT)) != 0; #if wxUSE_PALETTE if (oldPal)