M3.19: a negative dash entry makes the pattern invalid, so the line draws solid
The merged dasher clamped negative entries to zero, which turned [-5, 3] into dots instead of the solid line SVG and PDF draw for an invalid pattern (render test invalid_dash_pattern_strokes_solid). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
721bb483c3
commit
62569f8a9d
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue