]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/bitmap.cpp
fixing osx iphone build
[wxWidgets.git] / src / gtk / bitmap.cpp
index 0a519cf24ea15ca86d75255d9ab3374978eec841..b26bafcff7a813d8b30d495c0b33f9e9fd88f6dc 100644 (file)
@@ -79,6 +79,23 @@ wxMask::wxMask()
     m_bitmap = NULL;
 }
 
+wxMask::wxMask(const wxMask& mask)
+{
+    if ( !mask.m_bitmap )
+    {
+        m_bitmap = NULL;
+        return;
+    }
+
+    // create a copy of an existing mask
+    gint w, h;
+    gdk_drawable_get_size(mask.m_bitmap, &w, &h);
+    m_bitmap = gdk_pixmap_new(mask.m_bitmap, w, h, 1);
+
+    wxGtkObject<GdkGC> gc(gdk_gc_new(m_bitmap));
+    gdk_draw_drawable(m_bitmap, gc, mask.m_bitmap, 0, 0, 0, 0, -1, -1);
+}
+
 wxMask::wxMask( const wxBitmap& bitmap, const wxColour& colour )
 {
     m_bitmap = NULL;
@@ -655,6 +672,8 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
     else
 #endif
     {
+        wxUnusedVar(type); // The type is detected automatically by GDK.
+
         UnRef();
         GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(name.fn_str(), NULL);
         if (pixbuf)
@@ -777,7 +796,7 @@ bool wxBitmap::HasPixbuf() const
 void wxBitmap::SetPixbuf(GdkPixbuf* pixbuf)
 {
     UnRef();
-    
+
     if (!pixbuf)
         return;
 
@@ -859,12 +878,7 @@ wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const
     }
     if (oldRef->m_mask != NULL)
     {
-        newRef->m_mask = new wxMask;
-        newRef->m_mask->m_bitmap = gdk_pixmap_new(
-            oldRef->m_mask->m_bitmap, oldRef->m_width, oldRef->m_height, 1);
-        wxGtkObject<GdkGC> gc(gdk_gc_new(newRef->m_mask->m_bitmap));
-        gdk_draw_drawable(newRef->m_mask->m_bitmap,
-            gc, oldRef->m_mask->m_bitmap, 0, 0, 0, 0, -1, -1);
+        newRef->m_mask = new wxMask(*oldRef->m_mask);
     }
 
     return newRef;