From 1fc1e6af05bbadac95a0c14327afd49e0eb8ade6 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 26 Sep 2006 08:19:10 +0000 Subject: [PATCH] [ 1565385 ] wxImage scaling fix - apply mask when scaling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/image.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/common/image.cpp b/src/common/image.cpp index 2b43ad042c..652d2c905d 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -469,13 +469,7 @@ wxImage wxImage::Scale( int width, int height, int quality ) const unsigned char *source_alpha = 0 ; unsigned char *target_alpha = 0 ; - if (M_IMGDATA->m_hasMask) - { - image.SetMaskColour( M_IMGDATA->m_maskRed, - M_IMGDATA->m_maskGreen, - M_IMGDATA->m_maskBlue ); - } - else + if ( !M_IMGDATA->m_hasMask ) { source_alpha = M_IMGDATA->m_alpha ; if ( source_alpha ) @@ -514,6 +508,14 @@ wxImage wxImage::Scale( int width, int height, int quality ) const } } + // If the original image has a mask, apply the mask to the new image + if (M_IMGDATA->m_hasMask) + { + image.SetMaskColour( M_IMGDATA->m_maskRed, + M_IMGDATA->m_maskGreen, + M_IMGDATA->m_maskBlue ); + } + // In case this is a cursor, make sure the hotspot is scaled accordingly: if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) ) image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X,