X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/198c264dbcf226b5df0eed219aef30d6fdc38a71..63ced01b228ba426db163b75667a9b57d092f8db:/src/common/image.cpp?ds=sidebyside diff --git a/src/common/image.cpp b/src/common/image.cpp index a3c9483767..4fb2b0c254 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -668,13 +668,13 @@ wxImage wxImage::ResampleBilinear(int width, int height) const //result lines - dst_data[0] = r1 * dy1 + r2 * dy; - dst_data[1] = g1 * dy1 + g2 * dy; - dst_data[2] = b1 * dy1 + b2 * dy; + dst_data[0] = static_cast(r1 * dy1 + r2 * dy); + dst_data[1] = static_cast(g1 * dy1 + g2 * dy); + dst_data[2] = static_cast(b1 * dy1 + b2 * dy); dst_data += 3; if ( src_alpha ) - *dst_alpha++ = a1 * dy1 + a2 * dy; + *dst_alpha++ = static_cast(a1 * dy1 + a2 * dy); } } @@ -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; }