From 58b38d59c58cdd7a5bbe87e68aaca8bd36cc0b14 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 16 Aug 2016 12:19:48 -0400 Subject: [PATCH] container: Prepare to prune render nodes Add a should_propagate function for render nodes. Eventually, this is meant to avoid creating render nodes for child widgets that are outside the parents clip area. Since we don't have that information available right now, just filter out nondrawable children for now. --- gtk/gtkcontainer.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 736c86c1fd..9ad2763e7c 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -3405,6 +3405,16 @@ typedef struct { GArray *child_infos; } RenderData; +static gboolean +should_propagate_node (GtkWidget *child, + RenderData *data) +{ + if (!_gtk_widget_is_drawable (child)) + return FALSE; + + return TRUE; +} + static void propagate_render_node (GtkWidget *child, gpointer data_) @@ -3473,6 +3483,9 @@ collect_child_infos (GtkWidget *widget, GList *siblings; GdkWindow *window; + if (!should_propagate_node (widget, data)) + return; + info.child = widget; info.window_depth = G_MAXINT; @@ -3489,7 +3502,6 @@ collect_child_infos (GtkWidget *widget, g_array_append_val (data->child_infos, info); } - void gtk_container_propagate_render_node (GtkContainer *container, GskRenderer *renderer, @@ -3501,6 +3513,7 @@ gtk_container_propagate_render_node (GtkContainer *container, data.container = container; data.renderer = renderer; data.parent = parent_node; + data.child_infos = g_array_new (FALSE, TRUE, sizeof (ChildOrderInfo)); gtk_container_forall (container, collect_child_infos, &data);