EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge main into #2181; keep both sides of crates/svg/src/pathdata.rs
bflatastic3266a84c8dda
diff --cc crates/svg/src/pathdata.rsindex eb947373f,d70f114b8..7a2762db7--- a/crates/svg/src/pathdata.rs+++ b/crates/svg/src/pathdata.rs@@@ -226,16 -226,13 +226,18 @@@ fn segment(l: &mut Lex, c: u8, base: Velet sweep = l.flag()?;let e = pt(l)?;let arc = SvgArc { from: *cur, to: e, radii: Vec2::new(rx, ry), x_rotation: rot.to_radians(), large_arc: large, sweep };- match kurbo::Arc::from_svg_arc(&arc) {- Some(a) => {- // Scale tolerance with the radius so the segment count stays bounded.- let tol = 0.1_f64.max(a.radii.x.max(a.radii.y) * 1e-4);- a.to_cubic_beziers(tol, |c1, c2, end| p.curve_to(c1, c2, end))- }- None => p.line_to(e),+ let mut last_end = None;+ if let Some(a) = kurbo::Arc::from_svg_arc(&arc) {- a.to_cubic_beziers(0.1, |c1, c2, end| {++ // Scale tolerance with the radius so the segment count stays bounded.++ let tol = 0.1_f64.max(a.radii.x.max(a.radii.y) * 1e-4);++ a.to_cubic_beziers(tol, |c1, c2, end| {+ p.curve_to(c1, c2, end);+ last_end = Some(end);+ });+ }+ // Degenerate arcs (e.g. huge radii) may emit nothing or stop short of the end point.+ if last_end.is_none_or(|q| (q - e).hypot() > 1e-3 * (1.0 + e.to_vec2().hypot())) {+ p.line_to(e);}*cur = e;*last_cubic = None;