From 1fc3c2309669b3b1f808369e0bf13e92f87e50ee Mon Sep 17 00:00:00 2001 From: Ari Markowitz Date: Mon, 19 Oct 2026 20:44:16 +1300 Subject: [PATCH] #2558: the coarser glow test also pans by fractions of a pixel For review: after pans of (0.5, 0) and (37.3, -21.6), the Outer Glow made coarser over its whole reach (scale 2 and 3) is still drawn from the kept raster, placed at the nearest whole pixel as a full-size raster kept whole is, and each frame equals a fresh renderer's. Co-Authored-By: Claude Opus 5.5 --- crates/render/src/fx.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/render/src/fx.rs b/crates/render/src/fx.rs index 958004527..05b4f6945 100644 --- a/crates/render/src/fx.rs +++ b/crates/render/src/fx.rs @@ -2495,8 +2495,10 @@ mod tests { /// An Outer Glow whose whole reach is over the budget is made coarser over that whole reach and /// kept for any pan: its grid starts at the reach's first whole device pixel, which a pan by whole /// pixels moves with the art, so the raster drawn after the pan is the one a fresh renderer makes, - /// also for pans that aren't multiples of the raster's scale. Here a 100 pt glow at 500% (scale - /// 2) and a 2 pt glow round the page at 800% (scale 3, near the narrowest blur made coarser). + /// also for pans that aren't multiples of the raster's scale. A pan by a fraction of a pixel + /// places the raster at the nearest whole pixel, as a full-size raster kept whole is placed, and + /// here draws as a fresh renderer draws too. A 100 pt glow at 500% (scale 2) and a 2 pt glow + /// round the page at 800% (scale 3, near the narrowest blur made coarser). #[test] fn a_coarser_glow_kept_whole_draws_after_a_pan_as_made_again() { let size = (640, 360); @@ -2518,7 +2520,7 @@ mod tests { let image = |r: &Renderer| r.shadows.values().map(|e| std::sync::Arc::as_ptr(&e.image)).collect::>(); let kept = image(&r); assert!(r.shadows.values().all(|e| e.scale == scale && e.view.is_none()), "blur {blur}: coarser, over the whole reach"); - for pan in [(37.0, -21.0), (1.0, 0.0), (-3.0, 5.0)] { + for pan in [(37.0, -21.0), (1.0, 0.0), (-3.0, 5.0), (0.5, 0.0), (37.3, -21.6)] { let xf = Affine::translate(pan) * base; let panned = r.render(&d, size.0, size.1, xf, &opts); assert_eq!(image(&r), kept, "blur {blur}, pan {pan:?}: the raster kept is drawn");