From bbdc30ffee922c0eeeaa4cb24b0cec03303d7713 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 2 Jul 2023 01:00:41 -0400 Subject: [PATCH] gsk: Use stroke bounds for the stroke node We have the right api to use. --- gsk/gskrendernodeimpl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index ff343fba17..a4d3e1f425 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -4661,6 +4661,7 @@ gsk_stroke_node_new (GskRenderNode *child, { GskStrokeNode *self; GskRenderNode *node; + graphene_rect_t stroke_bounds; g_return_val_if_fail (GSK_IS_RENDER_NODE (child), NULL); g_return_val_if_fail (path != NULL, NULL); @@ -4673,8 +4674,10 @@ gsk_stroke_node_new (GskRenderNode *child, self->path = gsk_path_ref (path); gsk_stroke_init_copy (&self->stroke, stroke); - /* XXX: Figure out a way to compute bounds from the path */ - graphene_rect_init_from_rect (&node->bounds, &child->bounds); + if (gsk_path_get_stroke_bounds (self->path, &self->stroke, &stroke_bounds)) + graphene_rect_intersection (&stroke_bounds, &child->bounds, &node->bounds); + else + graphene_rect_init_from_rect (&node->bounds, graphene_rect_zero ()); return node; }