[gtk+/wip/ebassi/gsk-renderer: 499/545] gtk: Clean up render fallback node creation in GtkWidget



commit 2683d4d6e03bc039fdae2e2023d8509abb01838d
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Aug 4 19:19:46 2016 +0100

    gtk: Clean up render fallback node creation in GtkWidget

 gtk/gtkwidget.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 0f52e2d..7f7a7a7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -16075,17 +16075,15 @@ gtk_widget_create_render_node (GtkWidget   *widget,
   graphene_rect_t bounds;
   graphene_matrix_t m;
 
-  gtk_widget_get_allocation (widget, &allocation);
+  _gtk_widget_get_allocation (widget, &allocation);
   gtk_widget_get_clip (widget, &clip);
 
   graphene_rect_init (&bounds, 0, 0, clip.width, clip.height);
   graphene_matrix_init_translate (&m, graphene_point3d_init (&p, allocation.x, allocation.y, 0));
-  graphene_point3d_init (&p, clip.x - allocation.x, clip.y - allocation.y, 0);
 
   gsk_render_node_set_name (res, name);
   gsk_render_node_set_bounds (res, &bounds);
   gsk_render_node_set_transform (res, &m);
-  gsk_render_node_set_anchor_point (res, &p);
 
   return res;
 }
@@ -16097,15 +16095,19 @@ gtk_widget_get_render_node (GtkWidget   *widget,
   GtkWidgetClass *klass = GTK_WIDGET_GET_CLASS (widget);
   GskRenderNode *node;
   graphene_matrix_t m;
-  graphene_point3d_t tmp;
+  graphene_point3d_t p;
   graphene_rect_t bounds;
   GtkAllocation clip;
   GtkAllocation alloc;
 
+  if (_gtk_widget_get_alloc_needed (widget))
+    return NULL;
+
   gtk_widget_get_clip (widget, &clip);
-  gtk_widget_get_allocation (widget, &alloc);
+  _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, alloc.x, alloc.y, 0.f));
+  graphene_matrix_init_translate (&m, graphene_point3d_init (&p, alloc.x, alloc.y, 0.f));
+  graphene_point3d_init (&p, clip.x - alloc.x, clip.y - 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
@@ -16115,7 +16117,6 @@ 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);
 
@@ -16123,14 +16124,11 @@ gtk_widget_get_render_node (GtkWidget   *widget,
       gsk_render_node_set_name (tmp, str);
       gsk_render_node_set_bounds (tmp, &bounds);
       gsk_render_node_set_transform (tmp, &m);
-      gsk_render_node_set_anchor_point (tmp,
-                                        graphene_point3d_init (&p, clip.x - alloc.x,
-                                                                   clip.y - alloc.y,
-                                                                   0.f));
+      gsk_render_node_set_anchor_point (tmp, &p);
 
       cr = gsk_render_node_get_draw_context (tmp);
       cairo_translate (cr, alloc.x - clip.x, alloc.y - clip.y);
-      gtk_widget_draw (widget, cr);
+      gtk_widget_draw_internal (widget, cr, TRUE);
       cairo_destroy (cr);
 
       g_free (str);
@@ -16157,10 +16155,10 @@ gtk_widget_get_render_node (GtkWidget   *widget,
           gsk_render_node_set_name (tmp, str);
           gsk_render_node_set_bounds (tmp, &bounds);
           gsk_render_node_set_transform (tmp, &m);
-          cr = gsk_render_node_get_draw_context (tmp);
+          gsk_render_node_set_anchor_point (tmp, &p);
 
+          cr = gsk_render_node_get_draw_context (tmp);
           g_signal_emit (widget, widget_signals[DRAW], 0, cr, &result);
-
           cairo_destroy (cr);
 
           g_free (str);


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