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



commit 867ca3a13f93786b2525ad776b7b77973286f04b
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 2ef11a7..d359cc4 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -17472,17 +17472,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;
 }
@@ -17494,15 +17492,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
@@ -17512,7 +17514,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);
 
@@ -17520,14 +17521,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);
@@ -17554,10 +17552,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]