// course (except in !wxUSE_WXDIB), but is completely illogical
wxBitmap *self = wx_const_cast(wxBitmap *, this);
+ wxBitmapRefData *selfdata;
#if wxUSE_WXDIB
// copy the other bitmap
if ( data->m_hBitmap )
{
wxDIB dib((HBITMAP)(data->m_hBitmap));
self->CopyFromDIB(dib);
+
+ selfdata = wx_static_cast(wxBitmapRefData *, m_refData);
+ selfdata->m_hasAlpha = data->m_hasAlpha;
}
else
#endif // wxUSE_WXDIB
{
// copy the bitmap data
- self->m_refData = new wxBitmapRefData(*data);
+ selfdata = new wxBitmapRefData(*data);
+ self->m_refData = selfdata;
}
- wxBitmapRefData * const
- selfdata = wx_static_cast(wxBitmapRefData *, m_refData);
-
// copy also the mask
wxMask * const maskSrc = data->GetMask();
if ( maskSrc )
return false;
const bool hasAlpha = image.HasAlpha();
+
+ if (depth == -1)
+ depth = dib.GetDepth();
// store the bitmap parameters
wxBitmapRefData * const refData = new wxBitmapRefData;
refData->m_width = w;
refData->m_height = h;
refData->m_hasAlpha = hasAlpha;
- refData->m_depth = depth == -1 ? (hasAlpha ? 32 : 24)
- : depth;
+ refData->m_depth = depth;
m_refData = refData;