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/branches/WX_3_0_BRANCH@77516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-08-30 15:13:59 +00:00
parent 04519a46d7
commit 0e22e89086
2 changed files with 19 additions and 5 deletions

View File

@@ -607,6 +607,7 @@ wxMSW:
- Fix appearance of wxToggleButtons with non default colours (Artur Wieczorek).
- Fix drawing on wxDC when using right-to-left layout (Artur Wieczorek).
- Fix wxGrid appearance and behaviour in RTL (Artur Wieczorek).
- Fix creating wxBitmap from monochrome wxIcon or wxCursor (Artur Wieczorek).
- Add paragraph spacing attributes support to wxTextCtrl (dannchr).
- Show new style directory selector even for non existent paths (raychow).
- Fix order of radial gradient stops (Alexandru Pana).

View File

@@ -360,11 +360,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 )
{