+#endif // wxUSE_PALETTE
+}
+
+wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data)
+{
+ Create(data.m_width, data.m_height, data.m_bpp);
+
+ m_mask = data.m_mask ? new wxMask(*data.m_mask) : NULL;
+
+#if wxUSE_PALETTE
+ wxASSERT_MSG( !data.m_palette,
+ _T("copying bitmaps palette not implemented") );
+#endif // wxUSE_PALETTE
+
+
+ // copy the bitmap data by simply drawing the source bitmap on this one
+ GdkPixmap **dst;
+ if ( data.m_pixmap )
+ {
+ dst = &m_pixmap;
+ }
+ else if ( data.m_bitmap )
+ {
+ dst = &m_bitmap;
+ }
+ else // invalid bitmap?
+ {
+ return;
+ }
+
+ GdkGC *gc = gdk_gc_new(*dst);
+ if ( m_bpp == 1 )
+ {
+ gdk_wx_draw_bitmap(m_bitmap, gc, data.m_bitmap, 0, 0, 0, 0, -1, -1);
+ }
+ else // colour pixmap
+ {
+ gdk_draw_pixmap(m_pixmap, gc, data.m_pixmap, 0, 0, 0, 0, -1, -1);
+ }
+
+ gdk_gc_unref(gc);
+}
+
+bool wxBitmapRefData::Create(int width, int height, int bpp)
+{
+ m_width = width;
+ m_height = height;
+ m_bpp = bpp;
+
+ m_mask = NULL;
+#if wxUSE_PALETTE
+ m_palette = NULL;
+#endif
+
+ // to understand how this compiles you should know that GdkPixmap and
+ // GdkBitmap are one and the same type in GTK+ 1
+ GdkPixmap **ppix;
+ if ( m_bpp != 1 )
+ {
+ const GdkVisual * const visual = wxTheApp->GetGdkVisual();
+
+ wxCHECK_MSG( (bpp == -1) || (bpp == visual->depth) || (bpp == 32), false,
+ wxT("invalid bitmap depth") );
+
+ m_bpp = visual->depth;
+
+ ppix = &m_pixmap;
+ m_bitmap = NULL;
+ }
+ else // mono bitmap
+ {
+ ppix = &m_bitmap;
+ m_pixmap = NULL;
+ }
+
+ *ppix = gdk_pixmap_new( wxGetRootWindow()->window, width, height, m_bpp );
+
+ return *ppix != NULL;