X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/945c909da9a8ee487da102b8806b6fd76b5f6849..8995db52f311ef389652b0ac3aff39bde723c5ac:/src/common/image.cpp diff --git a/src/common/image.cpp b/src/common/image.cpp index cc63e385c1..4fb2b0c254 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1857,6 +1857,17 @@ void wxImage::InitAlpha() } } +void wxImage::ClearAlpha() +{ + wxCHECK_RET( HasAlpha(), wxT("image already doesn't have an alpha channel") ); + + if ( !M_IMGDATA->m_staticAlpha ) + free( M_IMGDATA->m_alpha ); + + M_IMGDATA->m_alpha = NULL; +} + + // ---------------------------------------------------------------------------- // mask support // ---------------------------------------------------------------------------- @@ -2341,8 +2352,6 @@ bool wxImage::DoLoad(wxImageHandler& handler, wxInputStream& stream, int index) if ( !handler.LoadFile(this, stream, true/*verbose*/, index) ) return false; - M_IMGDATA->m_type = handler.GetType(); - // rescale the image to the specified size if needed if ( maxWidth || maxHeight ) { @@ -2363,6 +2372,9 @@ bool wxImage::DoLoad(wxImageHandler& handler, wxInputStream& stream, int index) Rescale(width, height, wxIMAGE_QUALITY_HIGH); } + // Set this after Rescale, which currently does not preserve it + M_IMGDATA->m_type = handler.GetType(); + return true; }