diff options
author | Benjamin Otte <otte@redhat.com> | 2016-12-13 09:40:24 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-12-20 18:01:10 +0100 |
commit | 1137483d156a9062a746b07a6958a4057c115f6c (patch) | |
tree | 3a6fa6dba1c79ee4f98b8993bb871faaa005cda2 /gtk/gtksnapshotprivate.h | |
parent | 1f988d8b050b039f031122e906b0abb72f227cac (diff) | |
download | gtk+-1137483d156a9062a746b07a6958a4057c115f6c.tar.gz |
snapshot: Work on pushing and popping again
It is now possible to call push() subfunctions for simple container
nodes with just a single child. So you can for example
gtk_snapshot_push_clip() a clip region that all the nodes that get
appended later will then obey.
gtk_snapshot_pop() will then not return a container node, but a clip
node containing the container node (and similar for the transform
example).
This is implemented internally by providing a "collect function" when
pushing that is called when popping to collects all the accumulated
nodes and combine them into the single node that gets returned.
To simplify things even more, gtk_snapshot_pop_and_append() has been
added, which pops the currently pushed node and appends it to the
parent.
The icon rendering code has been converted to this approach.
Diffstat (limited to 'gtk/gtksnapshotprivate.h')
-rw-r--r-- | gtk/gtksnapshotprivate.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h index 9050c4f652..7eba0f48cc 100644 --- a/gtk/gtksnapshotprivate.h +++ b/gtk/gtksnapshotprivate.h @@ -24,6 +24,11 @@ G_BEGIN_DECLS typedef struct _GtkSnapshotState GtkSnapshotState; +typedef GskRenderNode * (* GtkSnapshotCollectFunc) (GskRenderNode **nodes, + guint n_nodes, + const char *name, + gpointer user_data); + struct _GtkSnapshotState { GtkSnapshotState *parent; @@ -33,6 +38,9 @@ struct _GtkSnapshotState { cairo_region_t *clip_region; double translate_x; double translate_y; + + GtkSnapshotCollectFunc collect_func; + gpointer collect_data; }; struct _GtkSnapshot { |