mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-20 09:05:51 +00:00
#3467: Radial Blur Zoom past 200 stays on its side of the centre
Zoom spreads its 32 samples over scales 1 ± Amount / 200 about the centre. Past Amount 200, which the range now allows, that reaches below 0 and samples the layer mirrored through the centre: at 1000 a layer white on the left and black on the right turned the right half 35 % grey. raster::radial_blur_zoom_scale keeps the old scales up to 200 exactly and spreads the samples evenly from the centre to 1 + Amount / 200 beyond. The CPU and GPU paths both take their samples from it. Work per pixel stays at 32 samples at any Amount.
This commit is contained in:
6 files changed
+81
-9
No files matched your search
@@ -100,14 +100,14 @@ fn radial_blur(e: &mut Enc, ctx: &EffectCtx, b: GBuf) -> Option<GBuf> {
|
||||
if amount.abs() < 1e-6 {
|
||||
return Some(b);
|
||||
}
|
||||
let n = 32usize;
|
||||
// The CPU's samples (`raster::radial_blur`).
|
||||
let n = effectcraft_raster::RADIAL_BLUR_SAMPLES;
|
||||
let mut data = Vec::with_capacity(2 * n);
|
||||
for i in 0..n {
|
||||
let t = i as f64 / (n - 1) as f64 - 0.5;
|
||||
if zoom {
|
||||
data.push((1.0 + t * amount) as f32);
|
||||
data.push(effectcraft_raster::radial_blur_zoom_scale(i, amount) as f32);
|
||||
} else {
|
||||
let (s, c) = (t * amount).to_radians().sin_cos();
|
||||
let (s, c) = effectcraft_raster::radial_blur_spin_angle(i, amount).to_radians().sin_cos();
|
||||
data.extend([s as f32, c as f32]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ fn radial_blur() {
|
||||
effect_case("ec.blur.radial", &[("amount", n(12.0))]);
|
||||
effect_case("ec.blur.radial", &[("amount", n(30.0)), ("type", e(1)), ("center", pt(20.3, 14.7))]);
|
||||
effect_case("ec.blur.radial", &[("amount", n(-45.0)), ("center", pt(50.0, 30.0))]);
|
||||
// Amount's largest value, 1000 (#3467): Spin over ±500°, Zoom from the centre outwards.
|
||||
effect_case("ec.blur.radial", &[("amount", n(1000.0)), ("center", pt(20.3, 14.7))]);
|
||||
effect_case("ec.blur.radial", &[("amount", n(1000.0)), ("type", e(1)), ("center", pt(20.3, 14.7)), ("antialiasing", e(1))]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user