diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 2aad167c93..49fe05908c 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -49,8 +49,10 @@ public: // implementation GdkBitmap *m_bitmap; + int m_width; + int m_height; - GdkBitmap *GetBitmap() const; + wxBitmap GetBitmap() const; private: wxDECLARE_DYNAMIC_CLASS(wxMask); diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index db48afe58a..fee40dfe68 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -172,6 +172,9 @@ bool wxMask::Create( const wxBitmap& bitmap, gdk_gc_unref( gc ); + m_width = bitmap.GetWidth(); + m_height = bitmap.GetHeight(); + return true; } @@ -211,12 +214,24 @@ bool wxMask::Create( const wxBitmap& bitmap ) gdk_gc_unref( gc ); + m_width = bitmap.GetWidth(); + m_height = bitmap.GetHeight(); + return true; } -GdkBitmap *wxMask::GetBitmap() const +wxBitmap wxMask::GetBitmap() const { - return m_bitmap; + wxBitmap bitmap; + + if (m_bitmap) + { + bitmap.SetBitmap( m_bitmap ); + bitmap.SetWidth( m_width ); + bitmap.SetHeight( m_height ); + } + + return bitmap; } @@ -534,7 +549,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, if (width % 8 != 0) dstbyteperline++; dst = (char*) malloc(dstbyteperline*height); - img = gdk_image_get( GetMask()->GetBitmap(), 0, 0, GetWidth(), GetHeight() ); + img = gdk_image_get( GetMask()->m_bitmap, 0, 0, GetWidth(), GetHeight() ); for (int h = 0; h < height; h++) { @@ -698,9 +713,9 @@ bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img) if (image.HasMask()) { - GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() ); + GdkGC *mask_gc = gdk_gc_new( GetMask()->m_bitmap ); - gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height ); + gdk_draw_image( GetMask()->m_bitmap, mask_gc, mask_image, 0, 0, 0, 0, width, height ); gdk_image_destroy( mask_image ); gdk_gc_unref( mask_gc ); @@ -938,9 +953,9 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img) if (image.HasMask()) { - GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() ); + GdkGC *mask_gc = gdk_gc_new( GetMask()->m_bitmap ); - gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height ); + gdk_draw_image( GetMask()->m_bitmap, mask_gc, mask_image, 0, 0, 0, 0, width, height ); gdk_image_destroy( mask_image ); gdk_gc_unref( mask_gc ); @@ -995,7 +1010,7 @@ wxImage wxBitmap::ConvertToImage() const GdkImage *gdk_image_mask = NULL; if (GetMask()) { - gdk_image_mask = gdk_image_get( GetMask()->GetBitmap(), + gdk_image_mask = gdk_image_get( GetMask()->m_bitmap, 0, 0, GetWidth(), GetHeight() ); diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 91301c58dd..88ba005345 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -206,7 +206,7 @@ void wxBitmapButton::OnSetBitmap() } GdkBitmap *mask = NULL; - if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap(); + if (the_one.GetMask()) mask = the_one.GetMask()->m_bitmap; GtkWidget *child = BUTTON_CHILD(m_widget); if (child == NULL) diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index ac13a60115..668d79e3de 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -1042,7 +1042,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, // apply mask if any GdkBitmap *mask = NULL; - if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); + if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->m_bitmap; GdkBitmap *new_mask = NULL; @@ -1265,7 +1265,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, // apply mask if any GdkBitmap *mask = NULL; - if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); + if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->m_bitmap; GdkBitmap *new_mask = NULL; @@ -1823,7 +1823,7 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush ) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) { gdk_gc_set_fill( m_textGC, GDK_OPAQUE_STIPPLED); - gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() ); + gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->m_bitmap ); } if (m_brush.IsHatch()) diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index 0c2f2c5947..3840bbe734 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -801,7 +801,7 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) GdkBitmap *mask; if ( icon->GetMask() ) - mask = icon->GetMask()->GetBitmap(); + mask = icon->GetMask()->m_bitmap; else mask = NULL; diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index cb17186a51..45240e0c85 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -517,7 +517,7 @@ bool wxNotebook::SetPageImage( size_t page, int image ) GdkBitmap *mask = NULL; if ( bmp.GetMask() ) { - mask = bmp.GetMask()->GetBitmap(); + mask = bmp.GetMask()->m_bitmap; } if (pixmapwid == NULL) @@ -684,7 +684,7 @@ bool wxNotebook::InsertPage( size_t position, GdkBitmap *mask = NULL; if ( bmp.GetMask() ) { - mask = bmp.GetMask()->GetBitmap(); + mask = bmp.GetMask()->m_bitmap; } GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask ); diff --git a/src/gtk1/statbmp.cpp b/src/gtk1/statbmp.cpp index 6af9f294c1..fa1619b4b5 100644 --- a/src/gtk1/statbmp.cpp +++ b/src/gtk1/statbmp.cpp @@ -73,7 +73,7 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) { GdkBitmap *mask = NULL; if (m_bitmap.GetMask()) - mask = m_bitmap.GetMask()->GetBitmap(); + mask = m_bitmap.GetMask()->m_bitmap; gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask); diff --git a/src/gtk1/tglbtn.cpp b/src/gtk1/tglbtn.cpp index f173f1a462..7e622834d6 100644 --- a/src/gtk1/tglbtn.cpp +++ b/src/gtk1/tglbtn.cpp @@ -136,7 +136,7 @@ void wxToggleBitmapButton::OnSetBitmap() if (!m_bitmap.IsOk()) return; GdkBitmap *mask = NULL; - if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); + if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->m_bitmap; GtkWidget *child = BUTTON_CHILD(m_widget); if (child == NULL) diff --git a/src/gtk1/toolbar.cpp b/src/gtk1/toolbar.cpp index f7bc1d9add..5032fa3fc7 100644 --- a/src/gtk1/toolbar.cpp +++ b/src/gtk1/toolbar.cpp @@ -123,7 +123,7 @@ public: { if (bitmap.IsOk()) { - GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap() + GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->m_bitmap : NULL; gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask ); } @@ -371,7 +371,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) GdkBitmap *mask = NULL; if ( bitmap.GetMask() ) - mask = bitmap.GetMask()->GetBitmap(); + mask = bitmap.GetMask()->m_bitmap; tool_pixmap = gtk_pixmap_new( pixmap, mask ); gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE ); diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index dc33e033c4..53fd8ac360 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -1103,7 +1103,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) { wxMask *mask = icon.GetMask(); GdkBitmap *bm = NULL; - if (mask) bm = mask->GetBitmap(); + if (mask) bm = mask->m_bitmap; gdk_window_set_icon( m_widget->window, NULL, icon.GetPixmap(), bm ); } @@ -1197,7 +1197,7 @@ static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region) { wxBitmap bmp = region.ConvertToBitmap(); bmp.SetMask(new wxMask(bmp, *wxBLACK)); - GdkBitmap* mask = bmp.GetMask()->GetBitmap(); + GdkBitmap* mask = bmp.GetMask()->m_bitmap; gdk_window_shape_combine_mask(window, mask, 0, 0); return true; }