[gtk+] gdk: Fix gdk_cairo_create() without begin_paint()



commit f3bd78a3cfff64cd0a043091e07bf46cd178cf0c
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 6 22:18:20 2014 +0200

    gdk: Fix gdk_cairo_create() without begin_paint()
    
    We were translating the clip region twice in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737825

 gdk/gdkwindow.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index e65e7d9..6b4817d 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -3039,7 +3039,7 @@ _gdk_window_ref_cairo_surface (GdkWindow *window)
  * Creates a Cairo context for drawing to @window.
  *
  * Note that calling cairo_reset_clip() on the resulting #cairo_t will
- * produce undefined results, so avoid it at all costs.
+ *rproduce undefined results, so avoid it at all costs.
  *
  * Returns: A newly created Cairo context. Free with
  *  cairo_destroy() when you are done drawing.
@@ -3060,11 +3060,15 @@ gdk_cairo_create (GdkWindow *window)
   cr = cairo_create (surface);
 
   if (window->impl_window->current_paint.region != NULL)
-    region = cairo_region_copy (window->impl_window->current_paint.region);
+    {
+      region = cairo_region_copy (window->impl_window->current_paint.region);
+      cairo_region_translate (region, -window->abs_x, -window->abs_y);
+    }
   else
-    region = cairo_region_copy (window->clip_region);
+    {
+      region = cairo_region_copy (window->clip_region);
+    }
 
-  cairo_region_translate (region, -window->abs_x, -window->abs_y);
   gdk_cairo_region (cr, region);
   cairo_region_destroy (region);
   cairo_clip (cr);


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