[gtk+] Clean up gdk_draw_drawable() composite handling
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Clean up gdk_draw_drawable() composite handling
- Date: Tue, 25 Aug 2009 08:38:47 +0000 (UTC)
commit c2546c859d3f41b0bf736c94101a9d65ea538afa
Author: Alexander Larsson <alexl redhat com>
Date: Tue Aug 25 10:34:10 2009 +0200
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.
gdk/gdkdraw.c | 17 +++--------------
gdk/gdkpixmap.c | 12 ++++++++----
gdk/gdkwindow.c | 10 ++++++++--
3 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index 041d94e..829dd2b 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 3d29805..919a202 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 977861e..7ca6c3c 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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]