diff options
author | Timm Bäder <tbaeder@redhat.com> | 2019-01-16 08:30:42 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2019-01-16 19:01:40 +0100 |
commit | cf1526cca62a956d1605fa6cdcc241e59c039600 (patch) | |
tree | e2c95587761dbc7d734d8a3585f58476c637664e /gtk/gtksnapshotprivate.h | |
parent | c1c764255f5108ea7b16ac590cc492a748d6fb26 (diff) | |
download | gtk+-cf1526cca62a956d1605fa6cdcc241e59c039600.tar.gz |
snapshot: Add gtk_snapshot_from_parent
Most of the time, the GtkSnapshot objects we create while snapshotting
widgets don't end up containing all that many nodes or states in their
respective node or state stack. This undermines the amortized allocation
behavior of the G(Ptr)Array we use for the stacks. So instead, use the
(until now unused) parent_snapshot GtkSnapshot* passed to
gtk_widget_create_render_node and reuse its node and state stack.
We do not avoid allocating a new GtkSnapshot object, but we do avoid
allocating a ton of G(Ptr)Array objects and we also avoid realloc'ing
their storage.
Diffstat (limited to 'gtk/gtksnapshotprivate.h')
-rw-r--r-- | gtk/gtksnapshotprivate.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h index b54fb4b702..5e554ca85e 100644 --- a/gtk/gtksnapshotprivate.h +++ b/gtk/gtksnapshotprivate.h @@ -90,6 +90,8 @@ struct _GdkSnapshot { GArray *state_stack; GPtrArray *nodes; + + guint from_parent : 1; }; struct _GtkSnapshotClass { @@ -99,6 +101,8 @@ struct _GtkSnapshotClass { void gtk_snapshot_append_node_internal (GtkSnapshot *snapshot, GskRenderNode *node); +GtkSnapshot * gtk_snapshot_new_with_parent (GtkSnapshot *parent_snapshot); + G_END_DECLS #endif /* __GTK_SNAPSHOT_PRIVATE_H__ */ |