X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42046cf5e3cc2fc94502d5c3d8b9009ef4ea8f84..9eb2347dc3527c32e6a041cba51431bf47c4eac4:/src/msw/bitmap.cpp?ds=sidebyside diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 570c673c49..307c67bada 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -264,23 +264,25 @@ wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *dataOrig) const // 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 ) @@ -840,14 +842,16 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) 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;