X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/327972e7b61eed1feb5a306c816541c2e0d2d301..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/common/image.cpp?ds=sidebyside diff --git a/src/common/image.cpp b/src/common/image.cpp index a3a5f0ada6..2c61998e6d 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -2254,7 +2254,7 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type) if ( type == wxBITMAP_TYPE_BMP_RESOURCE ) { - hBitmap = ::LoadBitmap(wxGetInstance(), name.t_str()); + hBitmap.Init( ::LoadBitmap(wxGetInstance(), name.t_str()) ); if ( !hBitmap ) { @@ -2278,8 +2278,8 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type) return wxImage(); } - hBitmap = info.hbmColor; - hMask = info.hbmMask; + hBitmap.Init(info.hbmColor); + hMask.Init(info.hbmMask); } } else if ( type == wxBITMAP_TYPE_CUR_RESOURCE ) @@ -2306,7 +2306,10 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type) image.SetMaskColour(0xc0, 0xc0, 0xc0); } - image.InitAlpha(); + // We could have already loaded alpha from the resources, but if not, + // initialize it now using the mask. + if ( !image.HasAlpha() ) + image.InitAlpha(); return image; }