diff options
author | Benjamin Otte <otte@redhat.com> | 2016-12-13 02:33:15 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-12-20 18:01:10 +0100 |
commit | 02131d590e2f4bdf9d2f487e619a3f08c1cf178e (patch) | |
tree | 0a2dd4fb6522b9d75ae31b75d6c11fe95fe0c1df /gtk/gtkrendericon.c | |
parent | ca80e9decf49acb042984bc07348d2fc93c03997 (diff) | |
download | gtk+-02131d590e2f4bdf9d2f487e619a3f08c1cf178e.tar.gz |
snapshot: Change how gtk_snapshot_push/pop works
Instead of appending a container node and adding the nodes to it as they
come in, we now collect the nodes until gtk_snapshot_pop() is called and
then hand them out in a container node.
The caller of gtk_snapshot_push() is then responsible for doing whatever
he wants with the created node.
Another addigion is the keep_coordinates flag to gtk_snapshot_push()
which allows callers to keep the current offset and clip region or
discard it. Discarding is useful when doing transforms, keeping it is
useful when inserting effect nodes (like the ones I'm about to add).
Diffstat (limited to 'gtk/gtkrendericon.c')
-rw-r--r-- | gtk/gtkrendericon.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c index 0304f0d02f..082f87d7d2 100644 --- a/gtk/gtkrendericon.c +++ b/gtk/gtkrendericon.c @@ -126,7 +126,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, else { graphene_matrix_t m1, m2, m3; - GskRenderNode *transform_node, *container_node; + GskRenderNode *transform_node, *icon_node; double offset_x, offset_y; gtk_snapshot_get_offset (snapshot, &offset_x, &offset_y); @@ -136,15 +136,16 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0)); graphene_matrix_multiply (&m2, &m3, &m1); - container_node = gsk_container_node_new (); - gsk_render_node_set_name (container_node, "CSS Icon Transform Container"); - transform_node = gsk_transform_node_new (container_node, &m1); + gtk_snapshot_push (snapshot, FALSE, "CSS Icon Transform Container"); + gtk_css_image_builtin_snapshot (image, snapshot, width, height, builtin_type); + icon_node = gtk_snapshot_pop (snapshot); + + transform_node = gsk_transform_node_new (icon_node, &m1); gsk_render_node_set_name (transform_node, "CSS Icon Transform"); gtk_snapshot_append_node (snapshot, transform_node); - gtk_snapshot_push_node (snapshot, container_node); - gtk_css_image_builtin_snapshot (image, snapshot, width, height, builtin_type); - gtk_snapshot_pop (snapshot); + gsk_render_node_unref (transform_node); + gsk_render_node_unref (icon_node); } } |