summaryrefslogtreecommitdiffstats
path: root/graphics/src/damage.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-01-20 13:52:15 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-20 13:52:15 +0100
commit545cc909c9f356dd733d273173694db9b8c28594 (patch)
treec8132edab4386bbccb07a372c3776f22abefbda3 /graphics/src/damage.rs
parentb3e3f6e3c9fc6879e6681810f54d7eaa7c0f3d30 (diff)
parent1c1667c3c99fa9b1009ef416b9b3c7e5a1d53a97 (diff)
downloadiced-545cc909c9f356dd733d273173694db9b8c28594.tar.gz
iced-545cc909c9f356dd733d273173694db9b8c28594.tar.bz2
iced-545cc909c9f356dd733d273173694db9b8c28594.zip
Merge pull request #1882 from nicksenger/shadows
Quad shadows
Diffstat (limited to 'graphics/src/damage.rs')
-rw-r--r--graphics/src/damage.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/graphics/src/damage.rs b/graphics/src/damage.rs
index 59e9f5b4..ba9192ef 100644
--- a/graphics/src/damage.rs
+++ b/graphics/src/damage.rs
@@ -78,6 +78,20 @@ impl<T: Damage> Damage for Primitive<T> {
// damage bounds (?)
raw.clip_bounds.expand(1.5)
}
+ Self::Quad { bounds, shadow, .. } if shadow.color.a > 0.0 => {
+ let bounds_with_shadow = Rectangle {
+ x: bounds.x + shadow.offset.x.min(0.0) - shadow.blur_radius,
+ y: bounds.y + shadow.offset.y.min(0.0) - shadow.blur_radius,
+ width: bounds.width
+ + shadow.offset.x.abs()
+ + shadow.blur_radius * 2.0,
+ height: bounds.height
+ + shadow.offset.y.abs()
+ + shadow.blur_radius * 2.0,
+ };
+
+ bounds_with_shadow.expand(1.0)
+ }
Self::Quad { bounds, .. }
| Self::Image { bounds, .. }
| Self::Svg { bounds, .. } => bounds.expand(1.0),