diff --git a/gsk/gskrendernode.h b/gsk/gskrendernode.h index f9b1657bb6..475cdffea7 100644 --- a/gsk/gskrendernode.h +++ b/gsk/gskrendernode.h @@ -487,7 +487,7 @@ GskRenderNode * gsk_stroke_node_get_child (GskRenderNode GDK_AVAILABLE_IN_ALL GskPath * gsk_stroke_node_get_path (GskRenderNode *node); GDK_AVAILABLE_IN_ALL -const GskStroke * gsk_stroke_node_get_stroke (GskRenderNode *node); +const GskStroke * gsk_stroke_node_get_stroke (const GskRenderNode *node); GDK_AVAILABLE_IN_ALL GType gsk_shadow_node_get_type (void) G_GNUC_CONST; diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index ff343fba17..072564a818 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -4567,6 +4567,7 @@ struct _GskStrokeNode GskRenderNode *child; GskPath *path; + GskPath *stroke_path; GskStroke stroke; }; @@ -4578,6 +4579,7 @@ gsk_stroke_node_finalize (GskRenderNode *node) gsk_render_node_unref (self->child); gsk_path_unref (self->path); + gsk_path_unref (self->stroke_path); gsk_stroke_clear (&self->stroke); parent_class->finalize (node); @@ -4672,6 +4674,7 @@ 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_stroke (path, &self->stroke); /* XXX: Figure out a way to compute bounds from the path */ graphene_rect_init_from_rect (&node->bounds, &child->bounds); @@ -4716,6 +4719,16 @@ gsk_stroke_node_get_path (GskRenderNode *node) return self->path; } +GskPath * +gsk_stroke_node_get_stroke_path (const GskRenderNode *node) +{ + const GskStrokeNode *self = (const GskStrokeNode *) node; + + g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_STROKE_NODE), NULL); + + return self->stroke_path; +} + /** * gsk_stroke_node_get_stroke: * @node: (type GskStrokeNode): a stroke #GskRenderNode @@ -4725,9 +4738,9 @@ gsk_stroke_node_get_path (GskRenderNode *node) * Returns: a #GskStroke */ const GskStroke * -gsk_stroke_node_get_stroke (GskRenderNode *node) +gsk_stroke_node_get_stroke (const GskRenderNode *node) { - GskStrokeNode *self = (GskStrokeNode *) node; + const GskStrokeNode *self = (const GskStrokeNode *) node; g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_STROKE_NODE), NULL); diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h index 4ad79bd593..f746af0025 100644 --- a/gsk/gskrendernodeprivate.h +++ b/gsk/gskrendernodeprivate.h @@ -87,6 +87,7 @@ gboolean gsk_container_node_is_disjoint (const GskRenderNode gboolean gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node); +GskPath * gsk_stroke_node_get_stroke_path (const GskRenderNode *node); G_END_DECLS