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:
parent
dd4a9de048
commit
1da74cbcd2
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user