[gtk+] Implement fallback for old draw_drawable vfunc



commit 60fa0da96d43baec777f598467044fbd816c4c47
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Aug 11 12:58:48 2009 +0200

    Implement fallback for old draw_drawable vfunc
    
    GdkDrawable->draw_drawback was replaced with a new vfunc
    draw_drawback_with_src that is now called from gdk_draw_drawable.
    However, some code seems to call the vfunc directly (see bug #591288),
    so make it chain to the new call.
    
    Note that such direct vfunc calls are a bad idea and won't work for all
    cases.

 gdk/gdkdraw.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index 7147530..8ab9464 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -61,6 +61,15 @@ static void         gdk_drawable_real_draw_pixbuf            (GdkDrawable  *draw
 							      GdkRgbDither  dither,
 							      gint          x_dither,
 							      gint          y_dither);
+static void         gdk_drawable_real_draw_drawable          (GdkDrawable  *drawable,
+							      GdkGC	   *gc,
+							      GdkDrawable  *src,
+							      gint          xsrc,
+							      gint	    ysrc,
+							      gint	    xdest,
+							      gint	    ydest,
+							      gint	    width,
+							      gint	    height);
      
 
 G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT)
@@ -74,6 +83,7 @@ gdk_drawable_class_init (GdkDrawableClass *klass)
   klass->get_clip_region = gdk_drawable_real_get_visible_region;
   klass->get_visible_region = gdk_drawable_real_get_visible_region;
   klass->draw_pixbuf = gdk_drawable_real_draw_pixbuf;
+  klass->draw_drawable = gdk_drawable_real_draw_drawable;
 }
 
 static void
@@ -1506,6 +1516,31 @@ composite_565 (guchar      *src_buf,
     }
 }
 
+/* Implementation of the old vfunc in terms of the new one
+   in case someone calls it directly (which they shouldn't!) */
+static void
+gdk_drawable_real_draw_drawable (GdkDrawable  *drawable,
+				 GdkGC	       *gc,
+				 GdkDrawable  *src,
+				 gint		xsrc,
+				 gint		ysrc,
+				 gint		xdest,
+				 gint		ydest,
+				 gint		width,
+				 gint		height)
+{
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable,
+							     gc,
+							     src,
+							     xsrc,
+							     ysrc,
+							     xdest,
+							     ydest,
+							     width,
+							     height,
+							     src);
+}
+
 static void
 gdk_drawable_real_draw_pixbuf (GdkDrawable  *drawable,
 			       GdkGC        *gc,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]