diff options
| author | 2024-01-20 12:11:18 +0100 | |
|---|---|---|
| committer | 2024-01-20 12:11:18 +0100 | |
| commit | b7b457a575cdd103915994f640c50262ce30a7c5 (patch) | |
| tree | c8b910de89e2e723051dc8058f796ec022026a49 /wgpu | |
| parent | 83902921a3065e8dadfaca23c2e03dd770d93780 (diff) | |
| download | iced-b7b457a575cdd103915994f640c50262ce30a7c5.tar.gz iced-b7b457a575cdd103915994f640c50262ce30a7c5.tar.bz2 iced-b7b457a575cdd103915994f640c50262ce30a7c5.zip  | |
Make `shadow` optional in `renderer::Quad`
Diffstat (limited to 'wgpu')
| -rw-r--r-- | wgpu/src/layer.rs | 20 | 
1 files changed, 13 insertions, 7 deletions
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs index 7b54601b..cb91878d 100644 --- a/wgpu/src/layer.rs +++ b/wgpu/src/layer.rs @@ -12,7 +12,9 @@ pub use text::Text;  use crate::core;  use crate::core::alignment; -use crate::core::{Color, Font, Pixels, Point, Rectangle, Size, Vector}; +use crate::core::{ +    Color, Font, Pixels, Point, Rectangle, Shadow, Size, Vector, +};  use crate::graphics;  use crate::graphics::color;  use crate::graphics::Viewport; @@ -198,12 +200,16 @@ impl<'a> Layer<'a> {                  border_radius,                  border_width,                  border_color, -                shadow_color, -                shadow_offset, -                shadow_blur_radius, +                shadow,              } => {                  let layer = &mut layers[current_layer]; +                let shadow = shadow.unwrap_or_else(|| Shadow { +                    color: Color::TRANSPARENT, +                    offset: Vector::ZERO, +                    blur_radius: 0.0, +                }); +                  let quad = Quad {                      position: [                          bounds.x + translation.x, @@ -213,9 +219,9 @@ impl<'a> Layer<'a> {                      border_color: color::pack(*border_color),                      border_radius: *border_radius,                      border_width: *border_width, -                    shadow_color: shadow_color.into_linear(), -                    shadow_offset: (*shadow_offset).into(), -                    shadow_blur_radius: *shadow_blur_radius, +                    shadow_color: shadow.color.into_linear(), +                    shadow_offset: shadow.offset.into(), +                    shadow_blur_radius: shadow.blur_radius,                  };                  layer.quads.add(quad, background);  | 
