Fix setting color depth of wxBitmap created from HBITMAP

When HBITMAP is assigned to wxBitmap with SetHBITMAP(), internal data
member representing wxBitmap's color depth should be set afterwards to
the bitmap color depth, not to the number of planes.
This commit is contained in:
Artur Wieczorek 2017-05-03 16:04:05 +02:00
parent dd4a9de048
commit 1da74cbcd2
3 changed files with 5 additions and 4 deletions

View File

@ -1630,7 +1630,7 @@ wxBitmap wxMask::GetBitmap() const
wxBitmap bmp;
bmp.SetHBITMAP((WXHBITMAP)hNewBitmap);
bmp.SetSize(bm.bmWidth, bm.bmHeight);
bmp.SetDepth(bm.bmPlanes);
bmp.SetDepth(bm.bmBitsPixel);
return bmp;
}

View File

@ -478,7 +478,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
wxBM->SetHBITMAP((WXHBITMAP) hNewBitmap);
wxBM->SetWidth(bm.bmWidth);
wxBM->SetHeight(bm.bmHeight);
wxBM->SetDepth(bm.bmPlanes);
wxBM->SetDepth(bm.bmBitsPixels);
retval = wxBM;
break;
}

View File

@ -1122,7 +1122,7 @@ bool wxBitmapDataObject2::SetData(size_t WXUNUSED(len), const void *pBuf)
wxLogLastError(wxT("GetObject(HBITMAP)"));
}
wxBitmap bitmap(bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes);
wxBitmap bitmap(bmp.bmWidth, bmp.bmHeight, bmp.bmBitsPixel);
bitmap.SetHBITMAP((WXHBITMAP)hbmp);
if ( !bitmap.IsOk() ) {
@ -1231,6 +1231,7 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format,
m_bitmap.SetWidth(pbmih->biWidth);
m_bitmap.SetHeight(pbmih->biHeight);
m_bitmap.SetDepth(pbmih->biBitCount);
}
else // CF_BITMAP
{
@ -1245,7 +1246,7 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format,
m_bitmap.SetWidth(bmp.bmWidth);
m_bitmap.SetHeight(bmp.bmHeight);
m_bitmap.SetDepth(bmp.bmPlanes);
m_bitmap.SetDepth(bmp.bmBitsPixel);
}
m_bitmap.SetHBITMAP((WXHBITMAP)hbmp);