[gtk/path-work-rebased: 72/123] gsk: Use stroke bounds in the stroke node
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/path-work-rebased: 72/123] gsk: Use stroke bounds in the stroke node
- Date: Thu, 7 Apr 2022 20:40:57 +0000 (UTC)
commit 2b680d876de2592d6b2ce23fc80a173ed42398d0
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 15 23:10:43 2020 -0500
gsk: Use stroke bounds in the stroke node
We can use gsk_path_get_stroke_bounds to get a
better estimate for the bounds of the stroke node.
gsk/gskrendernodeimpl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 704b24769a..b776a7630c 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -4033,6 +4033,7 @@ gsk_stroke_node_new (GskRenderNode *child,
{
GskStrokeNode *self;
GskRenderNode *node;
+ graphene_rect_t path_bounds;
g_return_val_if_fail (GSK_IS_RENDER_NODE (child), NULL);
g_return_val_if_fail (path != NULL, NULL);
@@ -4045,8 +4046,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 (path, stroke, &path_bounds))
+ graphene_rect_intersection (&path_bounds, &child->bounds, &node->bounds);
+ else
+ graphene_rect_init_from_rect (&node->bounds, graphene_rect_zero ());
return node;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]