From: Benjamin Otte Date: Tue, 19 Jun 2018 17:40:37 +0000 (+0200) Subject: snapshot: Compute correct size in gtk_snapshot_to_paintable() X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~22^2~62 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8c8dc3aeab1de296b0acc8fed3d9ae4c4103ad5c;p=gtk4.git snapshot: Compute correct size in gtk_snapshot_to_paintable() Also, do actually respect the passed in size argument if it isn't NULL. Fixes text being cut off inside DND icons. --- diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 9d70446791..ebb885e4ff 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -1115,9 +1115,19 @@ gtk_snapshot_to_paintable (GtkSnapshot *snapshot, graphene_rect_t bounds; node = gtk_snapshot_to_node (snapshot); - gsk_render_node_get_bounds (node, &bounds); + if (size) + { + graphene_size_init_from_size (&bounds.size, size); + } + else + { + gsk_render_node_get_bounds (node, &bounds); + bounds.size.width += bounds.origin.x; + bounds.size.height += bounds.origin.y; + } bounds.origin.x = 0; bounds.origin.y = 0; + paintable = gtk_render_node_paintable_new (node, &bounds); gsk_render_node_unref (node);