VectorCraft: An open-source, vector art tool written by scratch in pure Rust
M3.19: a negative dash entry makes the pattern invalid, so the line draws solid
bflatastic62569f8a9d6b
diff --git a/crates/effects/src/stroke/dash.rs b/crates/effects/src/stroke/dash.rsindex a5d8ce00f..16590f59f 100644--- a/crates/effects/src/stroke/dash.rs+++ b/crates/effects/src/stroke/dash.rs@@ -27,13 +27,14 @@ pub struct Dashed {pub dots: Vec<Dot>,}-/// Apply dash pattern `d` to `bp`. `None` when the pattern has no positive length (the line is-/// solid) or is too fine to draw (then the line is drawn solid too).+/// Apply dash pattern `d` to `bp`. `None` when the pattern is invalid (a negative or non-finite+/// entry, as in SVG and PDF) or has no positive length (the line is solid), or is too fine to draw+/// (then the line is drawn solid too).pub fn dash(bp: &BezPath, d: &Dash) -> Option<Dashed> {- if d.pattern.iter().any(|v| !v.is_finite()) || !d.offset.is_finite() {+ if d.pattern.iter().any(|v| !v.is_finite() || *v < 0.0) || !d.offset.is_finite() {return None;}- let mut pat: Vec<f64> = d.pattern.iter().map(|v| v.max(0.0)).collect();+ let mut pat = d.pattern.clone();if !pat.iter().any(|v| *v > MIN_ENTRY) {return None;}