diff options
author | 2024-04-03 21:07:54 +0200 | |
---|---|---|
committer | 2024-04-03 21:07:54 +0200 | |
commit | b05e61f5c8ae61c9f3c7cc08cded53901ebbccfd (patch) | |
tree | 3d35a011d94d4936f09b5a9be4031358a09c60da /renderer | |
parent | 99a904112ca111f2ab0e60e30b6c369741b1653b (diff) | |
download | iced-b05e61f5c8ae61c9f3c7cc08cded53901ebbccfd.tar.gz iced-b05e61f5c8ae61c9f3c7cc08cded53901ebbccfd.tar.bz2 iced-b05e61f5c8ae61c9f3c7cc08cded53901ebbccfd.zip |
Redesign `iced_wgpu` layering architecture
Diffstat (limited to 'renderer')
-rw-r--r-- | renderer/Cargo.toml | 1 | ||||
-rw-r--r-- | renderer/src/fallback.rs | 32 |
2 files changed, 24 insertions, 9 deletions
diff --git a/renderer/Cargo.toml b/renderer/Cargo.toml index 39c19fa3..946a8ebb 100644 --- a/renderer/Cargo.toml +++ b/renderer/Cargo.toml @@ -16,7 +16,6 @@ tiny-skia = ["iced_tiny_skia"] image = ["iced_tiny_skia?/image", "iced_wgpu?/image"] svg = ["iced_tiny_skia?/svg", "iced_wgpu?/svg"] geometry = ["iced_graphics/geometry", "iced_tiny_skia?/geometry", "iced_wgpu?/geometry"] -tracing = ["iced_wgpu?/tracing"] web-colors = ["iced_wgpu?/web-colors"] webgl = ["iced_wgpu?/webgl"] fira-sans = ["iced_graphics/fira-sans"] diff --git a/renderer/src/fallback.rs b/renderer/src/fallback.rs index b9ceb4b2..b6459243 100644 --- a/renderer/src/fallback.rs +++ b/renderer/src/fallback.rs @@ -39,16 +39,20 @@ where delegate!(self, renderer, renderer.clear()); } - fn start_layer(&mut self) { - delegate!(self, renderer, renderer.start_layer()); + fn start_layer(&mut self, bounds: Rectangle) { + delegate!(self, renderer, renderer.start_layer(bounds)); } fn end_layer(&mut self, bounds: Rectangle) { delegate!(self, renderer, renderer.end_layer(bounds)); } - fn start_transformation(&mut self) { - delegate!(self, renderer, renderer.start_transformation()); + fn start_transformation(&mut self, transformation: Transformation) { + delegate!( + self, + renderer, + renderer.start_transformation(transformation) + ); } fn end_transformation(&mut self, transformation: Transformation) { @@ -433,6 +437,7 @@ mod geometry { } } + #[derive(Clone)] pub enum Geometry<L, R> { Left(L), Right(R), @@ -452,10 +457,21 @@ mod geometry { } } - fn cache(self) -> Self::Cache { - match self { - Self::Left(geometry) => Geometry::Left(geometry.cache()), - Self::Right(geometry) => Geometry::Right(geometry.cache()), + fn cache(self, previous: Option<Self::Cache>) -> Self::Cache { + match (self, previous) { + (Self::Left(geometry), Some(Geometry::Left(previous))) => { + Geometry::Left(geometry.cache(Some(previous))) + } + (Self::Left(geometry), None) => { + Geometry::Left(geometry.cache(None)) + } + (Self::Right(geometry), Some(Geometry::Right(previous))) => { + Geometry::Right(geometry.cache(Some(previous))) + } + (Self::Right(geometry), None) => { + Geometry::Right(geometry.cache(None)) + } + _ => unreachable!(), } } } |