From a5f3298a0c04afd4dfed2ae52cc3efcc8e735b36 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 20 Oct 2026 20:08:18 -0700 Subject: [PATCH] Outline Stroke: use Expand's reshaped helper instead of a second copy outline_strokes in pathops.rs now imports reshaped from expand.rs, which has had it since #2616, and the copies of reshaped and with_path that this branch added to pathops.rs are removed. The two copies were identical, so Outline Stroke and Expand behave as before. --- crates/engine/src/cmd/expand.rs | 2 +- crates/engine/src/cmd/pathops.rs | 27 +-------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/crates/engine/src/cmd/expand.rs b/crates/engine/src/cmd/expand.rs index ebeacf63a..f1c841ff8 100644 --- a/crates/engine/src/cmd/expand.rs +++ b/crates/engine/src/cmd/expand.rs @@ -351,7 +351,7 @@ fn gradient_art(d: &mut Document, l: &Node, path: &PathData, bounds: Rect, f: &F /// Path `l` as the canvas paints its fills and strokes: its visible geometry effects applied to its /// path (a plain path then), and every geometry effect of its own removed. `None` when it has no /// visible geometry effect. -fn reshaped(l: &Node) -> Option { +pub(crate) fn reshaped(l: &Node) -> Option { use vectorcraft_render::effects::{GeomContext, apply_geometry_with, has_geometry, is_geometry}; if !has_geometry(&l.appearance.effects) { return None; diff --git a/crates/engine/src/cmd/pathops.rs b/crates/engine/src/cmd/pathops.rs index e2ba627ca..d400ad217 100644 --- a/crates/engine/src/cmd/pathops.rs +++ b/crates/engine/src/cmd/pathops.rs @@ -13,6 +13,7 @@ use vectorcraft_pathops as po; use vectorcraft_pathops::{BoolOp, PathfinderOp}; use super::edit::selected_roots; +use super::expand::reshaped; use super::*; pub fn specs() -> Vec { @@ -679,32 +680,6 @@ pub(crate) fn outline_strokes(d: &mut Document, brushes: &[vectorcraft_brush::Br assemble(d, l, parts) } -/// Path `l` as the canvas paints its fills and strokes: its visible geometry effects applied to its -/// path (a plain path then), and every geometry effect of its own removed. `None` when it has no -/// visible geometry effect. -pub(crate) fn reshaped(l: &Node) -> Option { - use vectorcraft_render::effects::{GeomContext, apply_geometry_with, has_geometry, is_geometry}; - if !has_geometry(&l.appearance.effects) { - return None; - } - let (path, _) = node_path(l)?; - let g = apply_geometry_with(&l.appearance.effects, &path, path.bounds()?, &GeomContext::of(l)); - let mut m = with_path(l, g); - m.appearance.effects.retain(|e| !is_geometry(&e.id)); - Some(m) -} - -/// Path or compound path `l` with `path` as its path, a plain path. -pub(crate) fn with_path(l: &Node, path: PathData) -> Node { - let mut m = l.clone(); - m.kind = match &l.kind { - NodeKind::Path { rule, clipping, guide, .. } => NodeKind::Path { path, rule: *rule, live: None, clipping: *clipping, guide: *guide }, - NodeKind::Compound { rule, .. } => NodeKind::Path { path, rule: *rule, live: None, clipping: false, guide: false }, - k => k.clone(), - }; - m -} - /// A plain copy of path `l` (new ids, no transparency, name or mask) painted with `items`. pub(crate) fn styled_copy(d: &mut Document, l: &Node, items: Vec) -> Node { let mut f = d.reid(l);