builder-tool: Include shadows in screenshots

Remove the clipping to the widget area that
GtkWidgetPaintable imposes, so we can see shadows
and other out-of-bounds rendering. This is particularly
useful for toplevel windows with client-side decorations.
This commit is contained in:
Matthias Clasen 2022-05-05 17:16:40 -04:00
parent a0374334d4
commit e3abd7df5c

View File

@ -48,6 +48,7 @@ draw_paintable (GdkPaintable *paintable,
GskRenderNode *node; GskRenderNode *node;
GdkTexture *texture; GdkTexture *texture;
GskRenderer *renderer; GskRenderer *renderer;
graphene_rect_t bounds;
snapshot = gtk_snapshot_new (); snapshot = gtk_snapshot_new ();
gdk_paintable_snapshot (paintable, gdk_paintable_snapshot (paintable,
@ -62,16 +63,29 @@ draw_paintable (GdkPaintable *paintable,
if (node == NULL) if (node == NULL)
return; return;
if (gsk_render_node_get_node_type (node) == GSK_CLIP_NODE)
{
GskRenderNode *child;
child = gsk_render_node_ref (gsk_clip_node_get_child (node));
gsk_render_node_unref (node);
node = child;
}
renderer = gtk_native_get_renderer ( renderer = gtk_native_get_renderer (
gtk_widget_get_native ( gtk_widget_get_native (
gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (paintable)))); gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (paintable))));
texture = gsk_renderer_render_texture (renderer,
node, gsk_render_node_get_bounds (node, &bounds);
&GRAPHENE_RECT_INIT ( graphene_rect_union (&bounds,
0, 0, &GRAPHENE_RECT_INIT (
gdk_paintable_get_intrinsic_width (paintable), 0, 0,
gdk_paintable_get_intrinsic_height (paintable) gdk_paintable_get_intrinsic_width (paintable),
)); gdk_paintable_get_intrinsic_height (paintable)
),
&bounds);
texture = gsk_renderer_render_texture (renderer, node, &bounds);
g_object_set_data_full (G_OBJECT (texture), g_object_set_data_full (G_OBJECT (texture),
"source-render-node", "source-render-node",
node, node,