diff options
author | 2024-04-14 13:43:10 +0200 | |
---|---|---|
committer | 2024-04-14 13:43:10 +0200 | |
commit | 105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a (patch) | |
tree | 4a5efa021b0dbe7d87ff57993c118753a32ea241 /core/src/renderer.rs | |
parent | ee105e3bee1bc676dcf3324693984ccda8e4e733 (diff) | |
parent | dbbbadfc950dfdfd02c7abbbf993e0685ca0f64a (diff) | |
download | iced-105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a.tar.gz iced-105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a.tar.bz2 iced-105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a.zip |
Merge pull request #2382 from iced-rs/wgpu/better-architecture
Improved architecture for `iced_wgpu` and `iced_tiny_skia`
Diffstat (limited to 'core/src/renderer.rs')
-rw-r--r-- | core/src/renderer.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/src/renderer.rs b/core/src/renderer.rs index 6712314e..a2785ae8 100644 --- a/core/src/renderer.rs +++ b/core/src/renderer.rs @@ -9,29 +9,29 @@ use crate::{ /// A component that can be used by widgets to draw themselves on a screen. pub trait Renderer { /// Starts recording a new layer. - fn start_layer(&mut self); + fn start_layer(&mut self, bounds: Rectangle); /// Ends recording a new layer. /// /// The new layer will clip its contents to the provided `bounds`. - fn end_layer(&mut self, bounds: Rectangle); + fn end_layer(&mut self); /// Draws the primitives recorded in the given closure in a new layer. /// /// The layer will clip its contents to the provided `bounds`. fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self)) { - self.start_layer(); + self.start_layer(bounds); f(self); - self.end_layer(bounds); + self.end_layer(); } /// Starts recording with a new [`Transformation`]. - fn start_transformation(&mut self); + fn start_transformation(&mut self, transformation: Transformation); /// Ends recording a new layer. /// /// The new layer will clip its contents to the provided `bounds`. - fn end_transformation(&mut self, transformation: Transformation); + fn end_transformation(&mut self); /// Applies a [`Transformation`] to the primitives recorded in the given closure. fn with_transformation( @@ -39,9 +39,9 @@ pub trait Renderer { transformation: Transformation, f: impl FnOnce(&mut Self), ) { - self.start_transformation(); + self.start_transformation(transformation); f(self); - self.end_transformation(transformation); + self.end_transformation(); } /// Applies a translation to the primitives recorded in the given closure. |