]> git.saurik.com Git - wxWidgets.git/commitdiff
[ 1565385 ] wxImage scaling fix - apply mask when scaling
authorRobert Roebling <robert@roebling.de>
Tue, 26 Sep 2006 08:19:10 +0000 (08:19 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 26 Sep 2006 08:19:10 +0000 (08:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/image.cpp

index 2b43ad042cbb9c1b302962eb9653d55b2cae7beb..652d2c905d87270990376b23a932c7a07c556a44 100644 (file)
@@ -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,