[gtk+/client-side-windows: 29/284] The double get_composite_drawable case can happen for pixmap targets too, so move the code to gdk_dr



commit 891440d2883d450b61d2f801295e91a266b35927
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Dec 5 21:42:22 2008 +0100

    The double get_composite_drawable case can happen for pixmap targets too, so move the code to gdk_draw_drawable
---
 gdk/gdkdraw.c   |   15 +++++++++++++--
 gdk/gdkwindow.c |    7 -------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index 7b3fb5a..8e8a3be 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -623,7 +623,7 @@ gdk_draw_drawable (GdkDrawable *drawable,
 		   gint         width,
 		   gint         height)
 {
-  GdkDrawable *composite;
+  GdkDrawable *composite, *composite_impl;
   gint composite_x_offset = 0;
   gint composite_y_offset = 0;
 
@@ -652,10 +652,21 @@ 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 clear that area in the destination instead. */
   
-  GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, composite,
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, composite_impl,
                                                     xsrc - composite_x_offset,
                                                     ysrc - composite_y_offset,
                                                     xdest, ydest,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 4c01723..ea5642f 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2764,13 +2764,6 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  /* By this time the src has been gotten via get_composite_drawable.
-     If it is a window this implies lots of stuff that we don't want
-     to do again in the call below. So, we use the impl as the source to
-     avoid this. */
-  if (GDK_IS_WINDOW (src))
-    src = GDK_WINDOW_OBJECT (src)->impl;
-  
   /* If we have a backing pixmap draw to that */
   if (private->paint_stack)
     {



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