Apply review fixes

- crates/pdf/src/gradient_inks.rs
This commit is contained in:
aiongg committed 2026-11-08 13:06:21 +00:00
1 parent c73699374f
commit 8ca6149325
1 file changed
+3 -2
+3 -2
View File
@@ -165,11 +165,12 @@ impl Exporter<'_> {
let mut expanded: Vec<(f32, Vec<f32>, 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<f32> = 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());