Fix creation of wxBitmap from monochrome wxIcon or wxCursor in wxMSW.

Don't suppose that we always have hbmColor because this is not true for
monochrome icons/cursors. Create our own bitmap in this case.

Closes #16512.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-08-30 15:14:18 +00:00
parent 51d715e46d
commit 73e915a573

View File

@@ -499,11 +499,24 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon,
int w = icon.GetWidth(),
h = icon.GetHeight();
refData->m_width = w;
refData->m_height = h;
refData->m_depth = wxDisplayDepth();
refData->m_hBitmap = (WXHBITMAP)iconInfo.hbmColor;
if ( iconInfo.hbmColor )
{
refData->m_width = w;
refData->m_height = h;
refData->m_depth = wxDisplayDepth();
refData->m_hBitmap = (WXHBITMAP)iconInfo.hbmColor;
}
else // we only have monochrome icon/cursor
{
// Then we need to create our own empty bitmap, which will be modified
// by the mask below.
wxDIB dib(w, h, wxDisplayDepth());
if ( dib.IsOk() )
{
memset(dib.GetData(), 0, wxDIB::GetLineSize(w, dib.GetDepth())*h);
refData->AssignDIB(dib);
}
}
switch ( transp )
{