From 8ca6149325ebd28d9999e49cb8ca4ab6fd7ce06d Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Sun, 8 Nov 2026 13:06:21 +0000 Subject: [PATCH] Apply review fixes - crates/pdf/src/gradient_inks.rs --- crates/pdf/src/gradient_inks.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/pdf/src/gradient_inks.rs b/crates/pdf/src/gradient_inks.rs index c92b80158..5cc72f7ce 100644 --- a/crates/pdf/src/gradient_inks.rs +++ b/crates/pdf/src/gradient_inks.rs @@ -165,11 +165,12 @@ impl Exporter<'_> { let mut expanded: Vec<(f32, Vec, f32)> = Vec::with_capacity(tints.len() * 2); for (k, (s, v)) in g.stops.iter().zip(&tints).enumerate() { expanded.push((s.offset, v.clone(), s.opacity)); + let midpoint = s.midpoint.clamp(0.01, 0.99); if let (Some(n), Some(nv)) = (g.stops.get(k + 1), tints.get(k + 1)) - && (s.midpoint - 0.5).abs() > 1e-3 + && (midpoint - 0.5).abs() > 1e-3 { let mid: Vec = v.iter().zip(nv).map(|(a, b)| (a + b) / 2.0).collect(); - expanded.push((s.offset + (n.offset - s.offset) * s.midpoint, mid, (s.opacity + n.opacity) / 2.0)); + expanded.push((s.offset + (n.offset - s.offset) * midpoint, mid, (s.opacity + n.opacity) / 2.0)); } } let mut stops = Vec::with_capacity(expanded.len());