rendernode-tool: Show the whole node

When the node had negative coords, those were cut off.

Translate by the node's origin to avoid this.
This commit is contained in:
Benjamin Otte
2024-07-05 05:12:57 +02:00
parent 347cdc63f8
commit c12d1fe29c

View File

@@ -57,6 +57,7 @@ show_file (const char *filename,
gboolean decorated)
{
GskRenderNode *node;
graphene_rect_t node_bounds;
GdkPaintable *paintable;
GtkWidget *sw;
GtkWidget *window;
@@ -65,8 +66,10 @@ show_file (const char *filename,
GtkWidget *picture;
node = load_node_file (filename);
gsk_render_node_get_bounds (node, &node_bounds);
snapshot = gtk_snapshot_new ();
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- node_bounds.origin.x, - node_bounds.origin.y));
gtk_snapshot_append_node (snapshot, node);
paintable = gtk_snapshot_free_to_paintable (snapshot, NULL);