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:
@@ -499,11 +499,24 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon,
|
|||||||
int w = icon.GetWidth(),
|
int w = icon.GetWidth(),
|
||||||
h = icon.GetHeight();
|
h = icon.GetHeight();
|
||||||
|
|
||||||
refData->m_width = w;
|
if ( iconInfo.hbmColor )
|
||||||
refData->m_height = h;
|
{
|
||||||
refData->m_depth = wxDisplayDepth();
|
refData->m_width = w;
|
||||||
|
refData->m_height = h;
|
||||||
refData->m_hBitmap = (WXHBITMAP)iconInfo.hbmColor;
|
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 )
|
switch ( transp )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user