[goocanvas] removed use of gdk_cairo_create()



commit 0cdce8eb34cbbb4b9fb9306ac56a773913791d89
Author: Damon Chaplin <Damon A Chaplin gmail com>
Date:   Wed Dec 14 17:49:23 2016 +0000

    removed use of gdk_cairo_create()

 ChangeLog       |    5 +++++
 src/goocanvas.c |   22 +++++++---------------
 2 files changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c1aad86..2d86d86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2016-12-14  Damon Chaplin  <damon localhost lan>
 
+       * src/goocanvas.c (goo_canvas_create_cairo_context): removed use of
+       gdk_cairo_create(). We always just use cairo_create() now.
+
+2016-12-14  Damon Chaplin  <damon localhost lan>
+
        * src/goocanvas.c (goo_canvas_focus_check_is_best): change comment
        that confused gtk-doc.
 
diff --git a/src/goocanvas.c b/src/goocanvas.c
index aee4317..35319fb 100644
--- a/src/goocanvas.c
+++ b/src/goocanvas.c
@@ -698,6 +698,8 @@ goo_canvas_setup_cairo_context (GooCanvas *canvas,
  * @canvas: a #GooCanvas.
  *
  * Creates a cairo context, initialized with the default canvas settings.
+ * Note that this context should not be used for drawing. It should only be
+ * used for calculating bounds of items.
  *
  * Returns: a new cairo context. It should be freed with cairo_destroy().
  **/
@@ -707,21 +709,11 @@ goo_canvas_create_cairo_context (GooCanvas *canvas)
   cairo_t *cr;
   cairo_surface_t *surface;
 
-  /* If the canvas is realized we can use the GDK function to create a cairo
-     context for the canvas window. Otherwise we create a small temporary
-     image surface. */
-  if (canvas && canvas->canvas_window)
-    {
-      cr = gdk_cairo_create (canvas->canvas_window);
-    }
-  else
-    {
-      surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
-      cr = cairo_create (surface);
-      /* The cairo context will keep a reference to the surface so we can
-        drop our reference. */
-      cairo_surface_destroy (surface);
-    }
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+  cr = cairo_create (surface);
+  /* The cairo context will keep a reference to the surface so we can
+     drop our reference. */
+  cairo_surface_destroy (surface);
 
   goo_canvas_setup_cairo_context (canvas, cr);
 


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