diff options
author | 2024-04-30 07:57:54 +0200 | |
---|---|---|
committer | 2024-04-30 07:57:54 +0200 | |
commit | b5b78d505e22cafccb4ecbf57dc61f536ca558ca (patch) | |
tree | 2563da1f3038607a329088ac3f7e460ca3d772fd /renderer | |
parent | 24501fd73b5ae884367a2d112ff44625058b876b (diff) | |
download | iced-b5b78d505e22cafccb4ecbf57dc61f536ca558ca.tar.gz iced-b5b78d505e22cafccb4ecbf57dc61f536ca558ca.tar.bz2 iced-b5b78d505e22cafccb4ecbf57dc61f536ca558ca.zip |
Introduce `canvas::Cache` grouping
Caches with the same `Group` will share their text
atlas!
Diffstat (limited to 'renderer')
-rw-r--r-- | renderer/src/fallback.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/renderer/src/fallback.rs b/renderer/src/fallback.rs index c932de00..5f69b420 100644 --- a/renderer/src/fallback.rs +++ b/renderer/src/fallback.rs @@ -428,8 +428,8 @@ where mod geometry { use super::Renderer; use crate::core::{Point, Radians, Rectangle, Size, Vector}; + use crate::graphics::cache::{self, Cached}; use crate::graphics::geometry::{self, Fill, Path, Stroke, Text}; - use crate::graphics::Cached; impl<A, B> geometry::Renderer for Renderer<A, B> where @@ -483,21 +483,25 @@ mod geometry { } } - fn cache(self, previous: Option<Self::Cache>) -> Self::Cache { + fn cache( + self, + group: cache::Group, + previous: Option<Self::Cache>, + ) -> Self::Cache { match (self, previous) { ( Self::Primary(geometry), Some(Geometry::Primary(previous)), - ) => Geometry::Primary(geometry.cache(Some(previous))), + ) => Geometry::Primary(geometry.cache(group, Some(previous))), (Self::Primary(geometry), None) => { - Geometry::Primary(geometry.cache(None)) + Geometry::Primary(geometry.cache(group, None)) } ( Self::Secondary(geometry), Some(Geometry::Secondary(previous)), - ) => Geometry::Secondary(geometry.cache(Some(previous))), + ) => Geometry::Secondary(geometry.cache(group, Some(previous))), (Self::Secondary(geometry), None) => { - Geometry::Secondary(geometry.cache(None)) + Geometry::Secondary(geometry.cache(group, None)) } _ => unreachable!(), } |