diff options
author | 2023-11-28 23:13:38 +0100 | |
---|---|---|
committer | 2023-11-28 23:13:38 +0100 | |
commit | ab7dae554cac801aeed5d9aa4d3850d50be86263 (patch) | |
tree | 4165df808d50fbaa4cb9b27ded59077b769a4135 /wgpu/src/layer.rs | |
parent | 100d15f30654d446cffe2fb60a435c79c81b0188 (diff) | |
download | iced-ab7dae554cac801aeed5d9aa4d3850d50be86263.tar.gz iced-ab7dae554cac801aeed5d9aa4d3850d50be86263.tar.bz2 iced-ab7dae554cac801aeed5d9aa4d3850d50be86263.zip |
Provide actual bounds to `Shader` primitives
... and allow for proper translation and scissoring.
Diffstat (limited to 'wgpu/src/layer.rs')
-rw-r--r-- | wgpu/src/layer.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs index 33aaf670..98e49f1a 100644 --- a/wgpu/src/layer.rs +++ b/wgpu/src/layer.rs @@ -1,11 +1,13 @@ //! Organize rendering primitives into a flattened list of layers. mod image; +mod pipeline; mod text; pub mod mesh; pub use image::Image; pub use mesh::Mesh; +pub use pipeline::Pipeline; pub use text::Text; use crate::core; @@ -36,7 +38,7 @@ pub struct Layer<'a> { pub images: Vec<Image>, /// The custom pipelines of this [`Layer`]. - pub pipelines: Vec<primitive::Pipeline>, + pub pipelines: Vec<Pipeline>, } impl<'a> Layer<'a> { @@ -314,17 +316,14 @@ impl<'a> Layer<'a> { }, primitive::Custom::Pipeline(pipeline) => { let layer = &mut layers[current_layer]; - - let bounds = Rectangle::new( - Point::new(translation.x, translation.y), - pipeline.bounds.size(), - ); + let bounds = pipeline.bounds + translation; if let Some(clip_bounds) = layer.bounds.intersection(&bounds) { - layer.pipelines.push(primitive::Pipeline { - bounds: clip_bounds, + layer.pipelines.push(Pipeline { + bounds, + viewport: clip_bounds, primitive: pipeline.primitive.clone(), }); } |