]> git.saurik.com Git - wxWidgets.git/commitdiff
use separate is-static flag for alpha channel and main data
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 2 Apr 2005 21:19:54 +0000 (21:19 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 2 Apr 2005 21:19:54 +0000 (21:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33282 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/image.cpp

index c8d8a280288ed22a39cb8a035c937ce6f316ea16..7767fedb90baa41abb06bf930ff7768a3d0c8204 100644 (file)
@@ -68,8 +68,13 @@ public:
     unsigned char  *m_alpha;
 
     bool            m_ok;
+
+    // if true, m_data is pointer to static data and shouldn't be freed
     bool            m_static;
 
+    // same as m_static but for m_alpha
+    bool            m_staticAlpha;
+
 #if wxUSE_PALETTE
     wxPalette       m_palette;
 #endif // wxUSE_PALETTE
@@ -93,16 +98,16 @@ wxImageRefData::wxImageRefData()
     m_hasMask = false;
 
     m_ok = false;
-    m_static = false;
+    m_static =
+    m_staticAlpha = false;
 }
 
 wxImageRefData::~wxImageRefData()
 {
-    if (!m_static)
-    {
+    if ( !m_static )
         free( m_data );
+    if ( !m_staticAlpha )
         free( m_alpha );
-    }
 }
 
 wxList wxImage::sm_handlers;
@@ -997,7 +1002,7 @@ void wxImage::SetAlpha( unsigned char *alpha, bool static_data )
 
     free(M_IMGDATA->m_alpha);
     M_IMGDATA->m_alpha = alpha;
-    M_IMGDATA->m_static = static_data;
+    M_IMGDATA->m_staticAlpha = static_data;
 }
 
 unsigned char *wxImage::GetAlpha() const