From 26200f0599051ee336aeea9c76c7d70be4e6fc9a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 21 Nov 2026 21:44:17 -0800 Subject: [PATCH] Smooth: read the anchors around a run through the edited list The merge of main brought in code that indexes the anchor list while smooth_open now keeps it in an EditsFromEnd, which has no indexing, so the engine did not build. The anchors at both ends of a run and of its neighboring segments are now read from the span that EditsFromEnd::get returns. --- crates/engine/src/cmd/draw2/smooth.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/draw2/smooth.rs b/crates/engine/src/cmd/draw2/smooth.rs index 8cf41929d9..65eac0afd2 100644 --- a/crates/engine/src/cmd/draw2/smooth.rs +++ b/crates/engine/src/cmd/draw2/smooth.rs @@ -755,8 +755,10 @@ fn smooth_open(anchors: &[Anchor], marked: &[bool], near: &dyn Fn(Point) -> bool // How much of the segments leading out of the run is in reach. A segment that is in reach // only at the run's anchor stays out of the piece, so the piece ends at that anchor rather // than in a sliver of a segment, which would leave the refit no direction to end along. - let after = if hi > b { split_at_reach(CubicBez::new(out[hi].p, out[hi].h_in, out[b].h_out, out[b].p), near, radius) } else { Reach::Whole }; - let before = if lo < a { split_at_reach(CubicBez::new(out[lo].p, out[lo].h_out, out[a].h_in, out[a].p), near, radius) } else { Reach::Whole }; + let Some(span) = out.get(lo, hi) else { continue }; + let (first, start, end, last) = (span[0], span[a - lo], span[b - lo], span[hi - lo]); + let after = if hi > b { split_at_reach(CubicBez::new(last.p, last.h_in, end.h_out, end.p), near, radius) } else { Reach::Whole }; + let before = if lo < a { split_at_reach(CubicBez::new(first.p, first.h_out, start.h_in, start.p), near, radius) } else { Reach::Whole }; if matches!(after, Reach::End) { hi = b; }