[gtk/wip/matthiasc/lottie-stroke: 11/16] Make stroke nodes use path-to-stroke
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/lottie-stroke: 11/16] Make stroke nodes use path-to-stroke
- Date: Wed, 2 Dec 2020 05:19:29 +0000 (UTC)
commit 8fd274530cf13faa573cb54b8198a529a179f7e7
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Nov 30 21:46:58 2020 -0500
Make stroke nodes use path-to-stroke
This significantly reduces our dependency on cairo:
we are now using our own stroker, instead of cairos.
gsk/gskrendernodeimpl.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 9c596a1a5c..a805ce93af 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -3434,6 +3434,7 @@ struct _GskStrokeNode
GskRenderNode *child;
GskPath *path;
GskStroke stroke;
+ GskPath *stroke_path;
};
static void
@@ -3445,6 +3446,7 @@ gsk_stroke_node_finalize (GskRenderNode *node)
gsk_render_node_unref (self->child);
gsk_path_unref (self->path);
gsk_stroke_clear (&self->stroke);
+ gsk_path_unref (self->stroke_path);
parent_class->finalize (node);
}
@@ -3457,25 +3459,18 @@ gsk_stroke_node_draw (GskRenderNode *node,
cairo_save (cr);
- gsk_cairo_rectangle (cr, &self->child->bounds);
+ gsk_path_to_cairo (self->stroke_path, cr);
cairo_clip (cr);
- cairo_push_group (cr);
gsk_render_node_draw (self->child, cr);
- cairo_pop_group_to_source (cr);
-
- gsk_stroke_to_cairo (&self->stroke, cr);
-
- gsk_path_to_cairo (self->path, cr);
- cairo_stroke (cr);
cairo_restore (cr);
}
static void
gsk_stroke_node_diff (GskRenderNode *node1,
- GskRenderNode *node2,
- cairo_region_t *region)
+ GskRenderNode *node2,
+ cairo_region_t *region)
{
GskStrokeNode *self1 = (GskStrokeNode *) node1;
GskStrokeNode *self2 = (GskStrokeNode *) node2;
@@ -3525,10 +3520,12 @@ gsk_stroke_node_new (GskRenderNode *child,
self->child = gsk_render_node_ref (child);
self->path = gsk_path_ref (path);
gsk_stroke_init_copy (&self->stroke, stroke);
+ self->stroke_path = gsk_path_to_stroke (self->path, &self->stroke);
- /* XXX: Figure out a way to compute bounds from the path */
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
+// gsk_path_get_bounds (self->stroke_path, &node->bounds);
+
return node;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]