blur: Fix invalid matrix inversions

This commit is contained in:
Victoria Brekenfeld 2026-06-11 16:41:04 +02:00 committed by Victoria Brekenfeld
parent 0c805d9b30
commit 4f8aed4149

View file

@ -218,7 +218,7 @@ impl BlurElement {
radii: [u8; 4],
strength: usize,
) -> Result<Option<Self>, R::Error> {
if strength == 0 {
if strength == 0 || geometry.size.w == 0. || geometry.size.h == 0. {
return Ok(None);
}
@ -237,12 +237,10 @@ impl BlurElement {
};
let geo_translation = {
let offset = geo.loc - extended_geo.loc;
Matrix3::from_translation(Vector2::new(
Matrix3::from_translation(-Vector2::new(
(offset.x / extended_geo.size.w) as f32,
(offset.y / extended_geo.size.h) as f32,
))
.invert()
.unwrap()
};
let input_to_geo = geo_scale * geo_translation;