]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
add wxImage::Clear (patch by troelsk); closes #10141
[wxWidgets.git] / src / common / image.cpp
index ba344445ef47d20963e9d4671b09a78c09c2388c..b3883e6a49586cbb8e3b6d1a28a1606c0cb5249a 100644 (file)
@@ -195,13 +195,15 @@ bool wxImage::Create( int width, int height, bool clear )
         return false;
     }
 
-    if (clear)
-        memset(M_IMGDATA->m_data, 0, width*height*3);
-
     M_IMGDATA->m_width = width;
     M_IMGDATA->m_height = height;
     M_IMGDATA->m_ok = true;
 
+    if (clear)
+    {
+        Clear();
+    }
+
     return true;
 }
 
@@ -246,6 +248,11 @@ void wxImage::Destroy()
     UnRef();
 }
 
+void wxImage::Clear(unsigned char value)
+{
+    memset(M_IMGDATA->m_data, value, M_IMGDATA->m_width*M_IMGDATA->m_height*3);
+}
+
 wxObjectRefData* wxImage::CreateRefData() const
 {
     return new wxImageRefData;