wxGTK1 : change type of wxMask.GetBitmap() from GdkBitmap* to wxBitmap

This commit is contained in:
Jouk
2019-12-19 09:20:36 +01:00
parent c06e50f389
commit d90953d8c6
10 changed files with 39 additions and 22 deletions

View File

@@ -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);

View File

@@ -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() );

View File

@@ -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)

View File

@@ -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())

View File

@@ -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;

View File

@@ -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 );

View File

@@ -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);

View File

@@ -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)

View File

@@ -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 );

View File

@@ -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;
}