[gtk+/wip/matthiasc/gsk-renderer: 11/11] container: Prepare to prune render nodes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/gsk-renderer: 11/11] container: Prepare to prune render nodes
- Date: Tue, 16 Aug 2016 16:20:47 +0000 (UTC)
commit f91034b926f37a34bce0fb906fdcab988b73762f
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Aug 16 12:19:48 2016 -0400
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 | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 429348f..c8e5061 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -3884,8 +3884,20 @@ typedef struct {
GskRenderer *renderer;
GskRenderNode *parent;
GArray *child_infos;
+ GtkWidget *toplevel;
+ GtkAllocation viewport;
} 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_)
@@ -3954,6 +3966,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;
@@ -3970,7 +3985,6 @@ collect_child_infos (GtkWidget *widget,
g_array_append_val (data->child_infos, info);
}
-
void
gtk_container_propagate_render_node (GtkContainer *container,
GskRenderer *renderer,
@@ -3982,6 +3996,9 @@ gtk_container_propagate_render_node (GtkContainer *container,
data.container = container;
data.renderer = renderer;
data.parent = parent_node;
+ data.toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
+ gtk_widget_get_allocation (data.toplevel, &data.viewport);
+
data.child_infos = g_array_new (FALSE, TRUE, sizeof (ChildOrderInfo));
gtk_container_forall (container, collect_child_infos, &data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]