From c4e6e42759a293e2e4d6a18db1b92316273efd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sat, 26 Apr 2025 03:16:45 +0200 Subject: [PATCH] Clip shadow bounds of floating images to the `viewport` --- widget/src/image.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/widget/src/image.rs b/widget/src/image.rs index 5a7bfb01..751e6eb9 100644 --- a/widget/src/image.rs +++ b/widget/src/image.rs @@ -538,6 +538,10 @@ where let clip_bounds = bounds.zoom(self.image.scale); let style = theme.style(&self.image.class); + let clip_bounds = clip_bounds + .intersection(&self.viewport) + .unwrap_or(self.viewport); + if style.shadow.color.a > 0.0 { renderer.with_layer( clip_bounds.expand(style.shadow.blur_radius), @@ -558,10 +562,6 @@ where ); } - let clip_bounds = clip_bounds - .intersection(&self.viewport) - .unwrap_or(self.viewport); - renderer.with_layer(clip_bounds, |renderer| { render( renderer,