[gtk+/wip/ebassi/gsk-renderer: 145/194] Fix fallback render nodes



commit 1e64fe0a6f109b7b2d242f454322d34c6c63b8d4
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 4 01:05:14 2016 -0400

    Fix fallback render nodes
    
    We were allocating a surface thats big enough for the clip, and
    we were setting the transform for that, but then GtkContainer
    was overriding the transform with the one for the allocation.
    Also, we were drawing at the clip position, not the allocation
    position.

 gtk/gtkwidget.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index be24e21..0fe8fdc 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -17476,10 +17476,12 @@ gtk_widget_get_render_node (GtkWidget   *widget,
   graphene_point3d_t tmp;
   graphene_rect_t bounds;
   GtkAllocation clip;
+  GtkAllocation alloc;
 
   gtk_widget_get_clip (widget, &clip);
+  gtk_widget_get_allocation (widget, &alloc);
   graphene_rect_init (&bounds, 0, 0, clip.width, clip.height);
-  graphene_matrix_init_translate (&m, graphene_point3d_init (&tmp, clip.x, clip.y, 0.f));
+  graphene_matrix_init_translate (&m, graphene_point3d_init (&tmp, alloc.x, alloc.y, 0.f));
 
   /* Compatibility mode: if the widget does not have a render node, we draw
    * using gtk_widget_draw() on a temporary node
@@ -17489,6 +17491,7 @@ gtk_widget_get_render_node (GtkWidget   *widget,
       GskRenderNode *tmp;
       cairo_t *cr;
       char *str;
+      graphene_point3d_t p;
 
       str = g_strconcat ("Fallback<", G_OBJECT_TYPE_NAME (widget), ">", NULL);
 
@@ -17497,6 +17500,8 @@ gtk_widget_get_render_node (GtkWidget   *widget,
       gsk_render_node_set_bounds (tmp, &bounds);
       gsk_render_node_set_transform (tmp, &m);
       cr = gsk_render_node_get_draw_context (tmp);
+      cairo_translate (cr, alloc.x - clip.x, alloc.y - clip.y);
+      gsk_render_node_set_offset (tmp, graphene_point3d_init (&p, clip.x - alloc.x, clip.y - alloc.y, 0.f));
 
       gtk_widget_draw (widget, cr);
 


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