[gtk/wip/baedert/for-master: 4/17] widget: Use gtk_snapshot_{push, pop})_collect



commit 815e0ef3a7f733b9ea3ae19f6dabdf8a1fb4f667
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 31 08:08:11 2020 +0100

    widget: Use gtk_snapshot_{push,pop})_collect
    
    So we avoid allocating a new snapshot just for that.

 gtk/gtkwidget.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c711ef88c3..a55bfde082 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -12136,22 +12136,21 @@ gtk_widget_maybe_add_debug_render_nodes (GtkWidget   *widget,
 
 static GskRenderNode *
 gtk_widget_create_render_node (GtkWidget   *widget,
-                               GtkSnapshot *parent_snapshot)
+                               GtkSnapshot *snapshot)
 {
   GtkWidgetClass *klass = GTK_WIDGET_GET_CLASS (widget);
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GtkCssBoxes boxes;
   GtkCssValue *filter_value;
   double opacity;
-  GtkSnapshot *snapshot;
 
   opacity = priv->alpha / 255.0;
   if (opacity <= 0.0)
     return NULL;
 
   gtk_css_boxes_init (&boxes, widget);
-  snapshot = gtk_snapshot_new_with_parent (parent_snapshot);
 
+  gtk_snapshot_push_collect (snapshot);
   gtk_snapshot_push_debug (snapshot,
                            "RenderNode for %s %p",
                            G_OBJECT_TYPE_NAME (widget), widget);
@@ -12190,7 +12189,7 @@ gtk_widget_create_render_node (GtkWidget   *widget,
 
   gtk_snapshot_pop (snapshot);
 
-  return gtk_snapshot_free_to_node (snapshot);
+  return gtk_snapshot_pop_collect (snapshot);
 }
 
 void


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