summaryrefslogtreecommitdiffstats
path: root/wgpu/src/layer.rs
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-09-14 13:58:36 -0700
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-11-14 11:31:44 +0100
commit781ef1f94c4859aeeb852f801b72be095b8ff82b (patch)
tree63e2678eca11dd41c26a40633c04341fd795d733 /wgpu/src/layer.rs
parent817f72868746461891ca4e74473c555f3b5c5703 (diff)
downloadiced-781ef1f94c4859aeeb852f801b72be095b8ff82b.tar.gz
iced-781ef1f94c4859aeeb852f801b72be095b8ff82b.tar.bz2
iced-781ef1f94c4859aeeb852f801b72be095b8ff82b.zip
Added support for custom shader widget for iced_wgpu backend.
Diffstat (limited to '')
-rw-r--r--wgpu/src/layer.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs
index 286801e6..d451cbfd 100644
--- a/wgpu/src/layer.rs
+++ b/wgpu/src/layer.rs
@@ -34,6 +34,9 @@ pub struct Layer<'a> {
/// The images of the [`Layer`].
pub images: Vec<Image>,
+
+ /// The custom shader primitives of this [`Layer`].
+ pub shaders: Vec<primitive::Shader>,
}
impl<'a> Layer<'a> {
@@ -45,6 +48,7 @@ impl<'a> Layer<'a> {
meshes: Vec::new(),
text: Vec::new(),
images: Vec::new(),
+ shaders: Vec::new(),
}
}
@@ -308,6 +312,18 @@ impl<'a> Layer<'a> {
}
}
},
+ primitive::Custom::Shader(shader) => {
+ let layer = &mut layers[current_layer];
+
+ let bounds = Rectangle::new(
+ Point::new(translation.x, translation.y),
+ shader.bounds.size(),
+ );
+
+ if layer.bounds.intersection(&bounds).is_some() {
+ layer.shaders.push(shader.clone());
+ }
+ }
},
}
}