[gtk+] gsk: Update Cairo renderer



commit a9bbb020aac9f20d7366b29219ada2e77349642a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Aug 25 11:29:00 2016 +0100

    gsk: Update Cairo renderer
    
    The Cairo renderer has been lagging behind a series of changes inside
    GskRenderer, like surface-less nodes, so it needs to be updated.

 gsk/gskcairorenderer.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskcairorenderer.c b/gsk/gskcairorenderer.c
index 282bb0f..3fa2ebe 100644
--- a/gsk/gskcairorenderer.c
+++ b/gsk/gskcairorenderer.c
@@ -50,6 +50,9 @@ gsk_cairo_renderer_render_node (GskCairoRenderer *self,
 
   cairo_save (cr);
 
+  if (!gsk_render_node_has_surface (node))
+    goto out;
+
   gsk_render_node_get_world_matrix (node, &mvp);
   if (graphene_matrix_to_2d (&mvp, &ctm.xx, &ctm.yx, &ctm.xy, &ctm.yy, &ctm.x0, &ctm.y0))
     {
@@ -81,8 +84,9 @@ gsk_cairo_renderer_render_node (GskCairoRenderer *self,
       pop_group = TRUE;
     }
 
-  GSK_NOTE (CAIRO, g_print ("Rendering surface %p for node %p at %g, %g\n",
+  GSK_NOTE (CAIRO, g_print ("Rendering surface %p for node %s[%p] at %g, %g\n",
                             gsk_render_node_get_surface (node),
+                            node->name,
                             node,
                             frame.origin.x, frame.origin.y));
   cairo_set_source_surface (cr, gsk_render_node_get_surface (node), frame.origin.x, frame.origin.y); 
@@ -102,6 +106,7 @@ gsk_cairo_renderer_render_node (GskCairoRenderer *self,
   cairo_matrix_invert (&ctm);
   cairo_transform (cr, &ctm);
 
+out:
   if (gsk_render_node_get_n_children (node) != 0)
     {
       GSK_NOTE (CAIRO, g_print ("Drawing %d children of node [%p]\n",
@@ -128,7 +133,11 @@ gsk_cairo_renderer_render (GskRenderer   *renderer,
 {
   GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer);
   GdkDrawingContext *context = gsk_renderer_get_drawing_context (renderer);
-  cairo_t *cr = gdk_drawing_context_get_cairo_context (context); 
+  cairo_t *cr;
+
+  cr = gdk_drawing_context_get_cairo_context (context);
+  if (cr == NULL)
+    return;
 
   gsk_renderer_get_viewport (renderer, &self->viewport);
 


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