]> git.saurik.com Git - wxWidgets.git/commitdiff
wxImage::Copy() forgot the alpha channel.
authorRobert Roebling <robert@roebling.de>
Thu, 26 Jan 2006 12:07:10 +0000 (12:07 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 26 Jan 2006 12:07:10 +0000 (12:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37150 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/image.cpp

index 02df26fdd920c31c18bc6770c99a1f6035211581..807bdd28902ee11fa68883beb16f3204af57ddf2 100644 (file)
@@ -261,9 +261,18 @@ wxImage wxImage::Copy() const
     image.SetMask( M_IMGDATA->m_hasMask );
 
     memcpy( data, GetData(), M_IMGDATA->m_width*M_IMGDATA->m_height*3 );
-
-    // also copy the image options
+    
     wxImageRefData *imgData = (wxImageRefData *)image.m_refData;
+    
+    // also copy the alpha channel
+    if (HasAlpha())
+    {
+        image.SetAlpha();
+        unsigned char* alpha = image.GetAlpha();
+        memcpy( alpha, GetAlpha(), M_IMGDATA->m_width*M_IMGDATA->m_height );
+    }
+    
+    // also copy the image options
     imgData->m_optionNames = M_IMGDATA->m_optionNames;
     imgData->m_optionValues = M_IMGDATA->m_optionValues;