From 714b82d28309881983fe38008cc1777709ad2b66 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 6 Nov 2026 21:43:14 -0500 Subject: [PATCH] EPS import: a shading that cuts nothing from its area, or a flat area, fills it as before --- crates/eps/src/import/graphics/paint.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/eps/src/import/graphics/paint.rs b/crates/eps/src/import/graphics/paint.rs index d0f8cb6788..ca3b1dee82 100644 --- a/crates/eps/src/import/graphics/paint.rs +++ b/crates/eps/src/import/graphics/paint.rs @@ -446,13 +446,14 @@ pub(super) fn shading_extent(sh: &DictRef, m: Affine, area: Rect) -> Option = + let corners: Vec = [(area.x0, area.y0), (area.x1, area.y0), (area.x1, area.y1), (area.x0, area.y1)].map(|(x, y)| inv * Point::new(x, y)).to_vec(); + let mut poly = corners.clone(); let c = nums("Coords"); let at = |i: usize| c.get(i).copied().filter(|v| v.is_finite()).unwrap_or(0.0); match d.get(&Key::name("ShadingType")).and_then(Obj::as_num) { @@ -482,6 +483,10 @@ pub(super) fn shading_extent(sh: &DictRef, m: Affine, area: Rect) -> Option return None, } + // Nothing cut: it paints the whole area. + if poly.len() == 4 && poly.iter().zip(&corners).all(|(a, b)| (*a - *b).hypot2() < 1e-18) { + return None; + } Some(poly.into_iter().map(|p| m * p).collect()) }