diff options
author | Alexander Larsson <alexl@redhat.com> | 2009-08-25 10:34:10 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2009-08-25 10:37:18 +0200 |
commit | c2546c859d3f41b0bf736c94101a9d65ea538afa (patch) | |
tree | e134f9a885cb57cf0175289b495d23368ff90deb /gdk | |
parent | c0084e21422c28e1b1039e509622e2b354b857f4 (diff) | |
download | gtk+-c2546c859d3f41b0bf736c94101a9d65ea538afa.tar.gz |
Clean up gdk_draw_drawable() composite handling
Instead of doing some magic in gdk_draw_drawable() to avoid double
offsetting when calling gdk_draw_drawable on the impl we call
the vfunc directly on the impl. Thus removing the weird magic from
gdk_draw_drawable().
I tested this with the testgtk test "text", where if the original magic
code is disabled typing a newline in the middle of a text line causes
the double offset issue to appear.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkdraw.c | 17 | ||||
-rw-r--r-- | gdk/gdkpixmap.c | 12 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 10 |
3 files changed, 19 insertions, 20 deletions
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 041d94e682..829dd2ba61 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -634,7 +634,7 @@ gdk_draw_drawable (GdkDrawable *drawable, gint width, gint height) { - GdkDrawable *composite, *composite_impl; + GdkDrawable *composite; gint composite_x_offset = 0; gint composite_y_offset = 0; @@ -663,24 +663,13 @@ gdk_draw_drawable (GdkDrawable *drawable, &composite_x_offset, &composite_y_offset); - /* The draw_drawable call below is will recurse into gdk_draw_drawable again, - * specifying the right impl for the destination. This means the composite - * we got here will be fed to get_composite_drawable again, which is a problem - * for window as that causes double the composite offset. Avoid this by passing - * in the impl directly. - */ - if (GDK_IS_WINDOW (composite)) - composite_impl = GDK_WINDOW_OBJECT (src)->impl; - else - composite_impl = composite; - /* TODO: For non-native windows this may copy stuff from other overlapping windows. We should clip that and (for windows with bg != None) clear that area in the destination instead. */ if (GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src) GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable, gc, - composite_impl, + composite, xsrc - composite_x_offset, ysrc - composite_y_offset, xdest, ydest, @@ -688,7 +677,7 @@ gdk_draw_drawable (GdkDrawable *drawable, src); else /* backwards compat for old out-of-tree implementations of GdkDrawable (are there any?) */ GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, - composite_impl, + composite, xsrc - composite_x_offset, ysrc - composite_y_offset, xdest, ydest, diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 3d29805770..919a20252f 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -385,10 +385,14 @@ gdk_pixmap_draw_drawable (GdkDrawable *drawable, { GdkPixmapObject *private = (GdkPixmapObject *)drawable; - _gdk_gc_remove_drawable_clip (gc); - gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc, - xdest, ydest, - width, height); + _gdk_gc_remove_drawable_clip (gc); + /* Call the method directly to avoid getting the composite drawable again */ + GDK_DRAWABLE_GET_CLASS (private->impl)->draw_drawable_with_src (private->impl, gc, + src, + xsrc, ysrc, + xdest, ydest, + width, height, + original_src); } static void diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 977861e831..7ca6c3c9d0 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -3654,8 +3654,14 @@ gdk_window_draw_drawable (GdkDrawable *drawable, BEGIN_DRAW; - gdk_draw_drawable (impl, gc, src, xsrc, ysrc, - xdest - x_offset, ydest - y_offset, width, height); + /* Call the method directly to avoid getting the composite drawable again */ + GDK_DRAWABLE_GET_CLASS (impl)->draw_drawable_with_src (impl, gc, + src, + xsrc, ysrc, + xdest - x_offset, + ydest - y_offset, + width, height, + original_src); if (!private->paint_stack) { |