X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ff5ad79411a4d5a88a3f76441ca5713d31cd5614..c932709d31bf359c994dc2050bec1b3b986bbd62:/src/common/image.cpp diff --git a/src/common/image.cpp b/src/common/image.cpp index 238b5195f8..d5ea5590e7 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -231,7 +231,7 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const { if( xFactor == 1 && yFactor == 1 ) return Copy() ; - + wxImage image; wxCHECK_MSG( Ok(), image, wxT("invalid image") ); @@ -242,7 +242,7 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const long old_height = M_IMGDATA->m_height, old_width = M_IMGDATA->m_width; - + wxCHECK_MSG( (old_height > 0) && (old_width > 0), image, wxT("invalid old image size") ); @@ -265,14 +265,14 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const maskRed = M_IMGDATA->m_maskRed; maskGreen = M_IMGDATA->m_maskGreen; maskBlue =M_IMGDATA->m_maskBlue ; - + image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue ); } char unsigned *source_data = M_IMGDATA->m_data; char unsigned *target_data = data; - + for (long y = 0; y < height; y++) { for (long x = 0; x < width; x++) @@ -935,8 +935,8 @@ bool wxImage::SetMaskFromImage(const wxImage& mask, return true; } - -bool wxImage::ConvertAlphaToMask(unsigned threshold) + +bool wxImage::ConvertAlphaToMask(unsigned char threshold) { if (!HasAlpha()) return true; @@ -947,19 +947,19 @@ bool wxImage::ConvertAlphaToMask(unsigned threshold) wxLogError( _("No unused colour in image being masked.") ); return false; } - + SetMask(true); SetMaskColour(mr, mg, mb); - + unsigned char *imgdata = GetData(); unsigned char *alphadata = GetAlpha(); - size_t w = GetWidth(); - size_t h = GetHeight(); + int w = GetWidth(); + int h = GetHeight(); - for (size_t y = 0; y < h; y++) + for (int y = 0; y < h; y++) { - for (size_t x = 0; x < w; x++, imgdata += 3, alphadata++) + for (int x = 0; x < w; x++, imgdata += 3, alphadata++) { if (*alphadata < threshold) { @@ -972,6 +972,8 @@ bool wxImage::ConvertAlphaToMask(unsigned threshold) free(M_IMGDATA->m_alpha); M_IMGDATA->m_alpha = NULL; + + return true; } #if wxUSE_PALETTE