From 9be3f7558d48832dcd5ecc601eff77d1851d22c9 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 13 Aug 2006 05:56:27 +0000 Subject: [PATCH] wxBitmap does not need to use gdk_wx_draw_bitmap git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/bitmap.cpp | 42 ++++++------------------------------------ src/gtk/dcclient.cpp | 1 + 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 2476c1b9e7..790e34f3d0 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -24,16 +24,6 @@ #include -extern void gdk_wx_draw_bitmap (GdkDrawable *drawable, - GdkGC *gc, - GdkDrawable *src, - gint xsrc, - gint ysrc, - gint xdest, - gint ydest, - gint width, - gint height); - //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -197,9 +187,8 @@ bool wxMask::Create( const wxBitmap& bitmap ) if (!m_bitmap) return false; GdkGC *gc = gdk_gc_new( m_bitmap ); - - gdk_wx_draw_bitmap( m_bitmap, gc, bitmap.GetPixmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() ); - + gdk_gc_set_function(gc, GDK_COPY_INVERT); + gdk_draw_drawable(m_bitmap, gc, bitmap.GetPixmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight()); g_object_unref (gc); return true; @@ -919,23 +908,9 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const else { ret = wxBitmap(rect.width, rect.height, M_BMPDATA->m_bpp); - if (M_BMPDATA->m_bpp != 1) - { - GdkGC *gc = gdk_gc_new( ret.GetPixmap() ); - gdk_draw_drawable( ret.GetPixmap(), gc, GetPixmap(), rect.x, rect.y, 0, 0, rect.width, rect.height ); - g_object_unref (gc); - } - else - { - GdkGC *gc = gdk_gc_new( ret.GetPixmap() ); - GdkColor col; - col.pixel = 0xFFFFFF; - gdk_gc_set_foreground( gc, &col ); - col.pixel = 0; - gdk_gc_set_background( gc, &col ); - gdk_wx_draw_bitmap( ret.GetPixmap(), gc, GetPixmap(), rect.x, rect.y, 0, 0, rect.width, rect.height ); - g_object_unref (gc); - } + GdkGC *gc = gdk_gc_new( ret.GetPixmap() ); + gdk_draw_drawable( ret.GetPixmap(), gc, GetPixmap(), rect.x, rect.y, 0, 0, rect.width, rect.height ); + g_object_unref (gc); } if (GetMask()) @@ -944,12 +919,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, rect.width, rect.height, 1 ); GdkGC *gc = gdk_gc_new( mask->m_bitmap ); - GdkColor col; - col.pixel = 0xFFFFFF; - gdk_gc_set_foreground( gc, &col ); - col.pixel = 0; - gdk_gc_set_background( gc, &col ); - gdk_wx_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, rect.x, rect.y, 0, 0, rect.width, rect.height ); + gdk_draw_drawable(mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, rect.x, rect.y, 0, 0, rect.width, rect.height); g_object_unref (gc); ret.SetMask( mask ); diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index e0898d91d0..4fff123998 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -82,6 +82,7 @@ static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } #include "gdk/gdkprivate.h" +static void gdk_wx_draw_bitmap(GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, -- 2.45.2