+ const wxBitmapRefData* oldRef = wx_static_cast(const wxBitmapRefData*, data);
+ wxBitmapRefData* newRef = new wxBitmapRefData;
+ newRef->m_width = oldRef->m_width;
+ newRef->m_height = oldRef->m_height;
+ newRef->m_bpp = oldRef->m_bpp;
+ if (oldRef->m_pixmap != NULL)
+ {
+ newRef->m_pixmap = gdk_pixmap_new(
+ oldRef->m_pixmap, oldRef->m_width, oldRef->m_height,
+ // use pixmap depth, m_bpp may not match
+ gdk_drawable_get_depth(oldRef->m_pixmap));
+ GdkGC* gc = gdk_gc_new(newRef->m_pixmap);
+ gdk_draw_drawable(
+ newRef->m_pixmap, gc, oldRef->m_pixmap, 0, 0, 0, 0, -1, -1);
+ g_object_unref(gc);
+ }
+ if (oldRef->m_pixbuf != NULL)
+ {
+ newRef->m_pixbuf = gdk_pixbuf_copy(oldRef->m_pixbuf);
+ }
+ 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);
+ 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);
+ g_object_unref(gc);
+ }
+#if wxUSE_PALETTE
+ // implement this if SetPalette is ever implemented
+ wxASSERT(oldRef->m_palette == NULL);
+#endif