Don't replace bitmap transparency with black when converting to icon in wxMSW.
This was a wrong workaround for incorrect drawing of the icons elsewhere and isn't needed if the destination is first AND-ed with the mask, as it should be. See #16512. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1908,21 +1908,6 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp,
|
|||||||
iconInfo.hbmMask = hbmpMask;
|
iconInfo.hbmMask = hbmpMask;
|
||||||
iconInfo.hbmColor = GetHbitmapOf(bmp);
|
iconInfo.hbmColor = GetHbitmapOf(bmp);
|
||||||
|
|
||||||
// black out the transparent area to preserve background colour, because
|
|
||||||
// Windows blits the original bitmap using SRCINVERT (XOR) after applying
|
|
||||||
// the mask to the dest rect.
|
|
||||||
{
|
|
||||||
MemoryHDC dcSrc, dcDst;
|
|
||||||
SelectInHDC selectMask(dcSrc, (HBITMAP)mask->GetMaskBitmap()),
|
|
||||||
selectBitmap(dcDst, iconInfo.hbmColor);
|
|
||||||
|
|
||||||
if ( !::BitBlt(dcDst, 0, 0, bmp.GetWidth(), bmp.GetHeight(),
|
|
||||||
dcSrc, 0, 0, SRCAND) )
|
|
||||||
{
|
|
||||||
wxLogLastError(wxT("BitBlt"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HICON hicon = ::CreateIconIndirect(&iconInfo);
|
HICON hicon = ::CreateIconIndirect(&iconInfo);
|
||||||
|
|
||||||
if ( !bmp.GetMask() && !bmp.HasAlpha() )
|
if ( !bmp.GetMask() && !bmp.HasAlpha() )
|
||||||
|
Reference in New Issue
Block a user