Add helper Set32bppHDIB() method to wxMSW wxBitmapRefData.

No real changes, just add a helper to allow replacing the HBITMAP stored in
wxBitmapRefData without changing anything else, this is going to be used in
another place soon.

See #12762.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-02-24 20:54:54 +00:00
parent 1eb46d68b8
commit f88fbcc2b3

View File

@ -74,6 +74,11 @@ public:
#if wxUSE_WXDIB
// Takes ownership of the given DIB.
bool AssignDIB(wxDIB& dib);
// Also takes ownership of the given DIB, but doesn't change any other
// fields (which are supposed to be already set), and just updates
// m_hasAlpha because 32 bit DIBs always do have it.
void Set32bppHDIB(HBITMAP hdib);
#endif // wxUSE_WXDIB
@ -310,6 +315,15 @@ bool wxBitmapRefData::AssignDIB(wxDIB& dib)
return true;
}
void wxBitmapRefData::Set32bppHDIB(HBITMAP hdib)
{
Free();
m_isDIB = true;
m_hasAlpha = true;
m_hBitmap = hdib;
}
#endif // wxUSE_WXDIB
// ----------------------------------------------------------------------------
@ -424,11 +438,7 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon,
{
HBITMAP hdib = 0;
if ( CheckAlpha(iconInfo.hbmColor, &hdib) )
{
refData->m_hasAlpha = true;
::DeleteObject(refData->m_hBitmap);
refData->m_hBitmap = hdib;
}
refData->Set32bppHDIB(hdib);
}
break;
#endif // wxUSE_WXDIB