[gtk+/client-side-windows: 20/284] Move clip offsetting into _gdk_gc_intersect_clip_region



commit 5ff017e64ef34cd13f8ffd0364dd2133aba09817
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Dec 4 19:36:13 2008 +0100

    Move clip offsetting into _gdk_gc_intersect_clip_region
---
 gdk/gdkgc.c        |   10 +++++++++-
 gdk/gdkinternals.h |    2 ++
 gdk/gdkwindow.c    |   33 +++++++++++++++------------------
 3 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c
index 7b7e4ee..6bc3a99 100644
--- a/gdk/gdkgc.c
+++ b/gdk/gdkgc.c
@@ -564,17 +564,25 @@ _gdk_gc_set_clip_region_internal (GdkGC     *gc,
   _gdk_windowing_gc_set_clip_region (gc, region, reset_origin);
 }
 
-/* Takes ownership of passed in region, returns old clip region */
+/* returns old clip region */
 void
 _gdk_gc_intersect_clip_region (GdkGC     *gc,
 			       GdkRegion *region,
+			       int        offset_x,
+			       int        offset_y,
 			       GdkRegion **old_clip_region)
 {
   GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
   GdkRegion *old_clip;
+  gboolean free;
 
   old_clip = priv->clip_region;
 
+  region = gdk_region_copy (region);
+
+  if (offset_x != 0 || offset_y != 0)
+    gdk_region_offset (region, offset_x, offset_y);
+  
   priv->clip_region = region;
   if (old_clip)
     gdk_region_intersect (region, old_clip);
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 3a1c1c6..995f3bf 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -295,6 +295,8 @@ guint32    _gdk_gc_get_fg_pixel    (GdkGC *gc);
 guint32    _gdk_gc_get_bg_pixel    (GdkGC *gc);
 void      _gdk_gc_intersect_clip_region     (GdkGC     *gc,
 					     GdkRegion *region,
+					     int        offset_x,
+					     int        offset_y,
 					     GdkRegion **old_region);
 void       _gdk_gc_set_clip_region_internal (GdkGC     *gc,
 					     GdkRegion *region,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 59cd8f4..5d9b812 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1983,6 +1983,7 @@ gdk_window_begin_paint_region (GdkWindow       *window,
 				     clip_box.x, clip_box.y,
 				     clip_box.width, clip_box.height);
     }
+
 #endif /* USE_BACKING_STORE */
 }
 
@@ -2270,16 +2271,15 @@ setup_clip_for_draw (GdkDrawable *drawable,
   GdkRegion *clip;
 
   if (_gdk_gc_get_subwindow (gc) == GDK_CLIP_BY_CHILDREN)
-    clip = gdk_region_copy (private->clip_region_with_children);
+    clip = private->clip_region_with_children;
   else
-    clip = gdk_region_copy (private->clip_region);
+    clip = private->clip_region;
     
-  /* There was a clip origin set appart from the window offset,
-     need to take this into consideration */
-  if (old_clip_x != 0 || old_clip_y != 0)
-    gdk_region_offset (clip, -old_clip_x, -old_clip_y);
-
-  _gdk_gc_intersect_clip_region (gc, clip, old_clip_region);
+  _gdk_gc_intersect_clip_region (gc, clip,
+				 /* If there was a clip origin set appart from the
+				  * window offset, need to take that into consideration */
+				 -old_clip_x, -old_clip_y,
+				 old_clip_region);
 }
 
 static void
@@ -2289,16 +2289,13 @@ setup_clip_for_paint (GdkDrawable *drawable,
 		      int old_clip_x, int old_clip_y,
 		      GdkRegion **old_clip_region)
 {
-  GdkRegion *clip;
-
-  clip = gdk_region_copy (paint->region);
-  
-  /* There was a clip origin set appart from the window offset,
-     need to take this into consideration */
-  if (old_clip_x != 0 || old_clip_y != 0)
-    gdk_region_offset (clip, -old_clip_x, -old_clip_y);
-
-  _gdk_gc_intersect_clip_region (gc, clip, old_clip_region);
+  _gdk_gc_intersect_clip_region (gc,
+				 /* This includes the window clip */
+				 paint->region,
+				 /* If there was a clip origin set appart from the
+				  * window offset, need to take that into consideration */
+				 -old_clip_x, -old_clip_y,
+				 old_clip_region);
 }
 
 



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