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
This commit is contained in:
Vadim Zeitlin
2014-10-19 12:57:04 +00:00
parent bb54c6569d
commit cf61bbb168

View File

@@ -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)