[gtk+/rendering-cleanup: 76/81] generic damage generation for offscreen windows



commit e8fdf916ccaaf4c78a27cfa49771574366814eb1
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Aug 4 18:43:53 2010 -0400

    generic damage generation for offscreen windows
    
    Generating damage from gdk drawing api doesn't help for cairo rendering
    ...and the gdk drawing api is gone anyway. Bug 621571

 gdk/gdkoffscreenwindow.c |   39 ---------------------------------------
 gdk/gdkwindow.c          |    4 ++++
 2 files changed, 4 insertions(+), 39 deletions(-)
---
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index b09157a..a0c0001 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -209,45 +209,6 @@ gdk_offscreen_window_get_visual (GdkDrawable    *drawable)
   return gdk_drawable_get_visual (offscreen->wrapper);
 }
 
-static void
-add_damage (GdkOffscreenWindow *offscreen,
-	    int x, int y,
-	    int w, int h,
-	    gboolean is_line)
-{
-  GdkRectangle rect;
-  cairo_region_t *damage;
-
-  rect.x = x;
-  rect.y = y;
-  rect.width = w;
-  rect.height = h;
-
-  if (is_line)
-    {
-      /* This should really take into account line width, line
-       * joins (and miter) and line caps. But these are hard
-       * to compute, rarely used and generally a pain. And in
-       * the end a snug damage rectangle is not that important
-       * as multiple damages are generally created anyway.
-       *
-       * So, we just add some padding around the rect.
-       * We use a padding of 3 pixels, plus an extra row
-       * below and on the right for the normal line size. I.E.
-       * line from (0,0) to (2,0) gets h=0 but is really
-       * at least one pixel tall.
-       */
-      rect.x -= 3;
-      rect.y -= 3;
-      rect.width += 7;
-      rect.height += 7;
-    }
-
-  damage = cairo_region_create_rectangle (&rect);
-  _gdk_window_add_damage (offscreen->wrapper, damage);
-  cairo_region_destroy (damage);
-}
-
 void
 _gdk_offscreen_window_new (GdkWindow     *window,
 			   GdkScreen     *screen,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index f39d2ca..81f3ab3 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -4305,6 +4305,10 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
   if (cairo_region_is_empty (expose_region))
     return;
 
+  if (gdk_window_is_offscreen (private->impl_window) &&
+      private == private->impl_window)
+    _gdk_window_add_damage ((GdkWindow *) private->impl_window, expose_region);
+
   /* Make this reentrancy safe for expose handlers freeing windows */
   children = g_list_copy (private->children);
   g_list_foreach (children, (GFunc)g_object_ref, NULL);



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