From 3553911e3f3e3e15dd7369e705e337b38c6aabbf Mon Sep 17 00:00:00 2001 From: SAY-5 Date: Thu, 21 May 2026 12:43:07 -0700 Subject: [PATCH] fix: subtract region.y() from y-coordinates in feSpotLight transform `transform_light_source` was subtracting `region.x()` from the y-component of both the light source position and its `points_at` target in the `SpotLight` branch. The result is that whenever the filter region origin has `x != y`, the spotlight is offset by `region.x() - region.y()` pixels on the y axis, producing mis-rendered lighting. The adjacent `PointLight` branch uses `region.y()` correctly, so this is a copy-paste bug introduced when the SpotLight branch was derived from PointLight. --- crates/resvg/src/filter/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/resvg/src/filter/mod.rs b/crates/resvg/src/filter/mod.rs index 29ff3a7a4..174f48b34 100644 --- a/crates/resvg/src/filter/mod.rs +++ b/crates/resvg/src/filter/mod.rs @@ -1076,13 +1076,13 @@ fn transform_light_source( let mut point = tiny_skia::Point::from_xy(light.x, light.y); ts.map_point(&mut point); light.x = point.x - region.x() as f32; - light.y = point.y - region.x() as f32; + light.y = point.y - region.y() as f32; light.z *= sz; let mut point = tiny_skia::Point::from_xy(light.points_at_x, light.points_at_y); ts.map_point(&mut point); light.points_at_x = point.x - region.x() as f32; - light.points_at_y = point.y - region.x() as f32; + light.points_at_y = point.y - region.y() as f32; light.points_at_z *= sz; } }