Introduce canvas::Cache grouping

Caches with the same `Group` will share their text
atlas!
This commit is contained in:
Héctor Ramón Jiménez 2024-04-30 07:57:54 +02:00
parent 24501fd73b
commit b5b78d505e
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
10 changed files with 279 additions and 101 deletions

View file

@ -1,9 +1,10 @@
use crate::core::text::LineHeight;
use crate::core::{Pixels, Point, Radians, Rectangle, Size, Vector};
use crate::graphics::cache::{self, Cached};
use crate::graphics::geometry::fill::{self, Fill};
use crate::graphics::geometry::stroke::{self, Stroke};
use crate::graphics::geometry::{self, Path, Style};
use crate::graphics::{Cached, Gradient, Text};
use crate::graphics::{Gradient, Text};
use crate::Primitive;
use std::rc::Rc;
@ -32,7 +33,7 @@ impl Cached for Geometry {
Self::Cache(cache.clone())
}
fn cache(self, _previous: Option<Cache>) -> Cache {
fn cache(self, _group: cache::Group, _previous: Option<Cache>) -> Cache {
match self {
Self::Live {
primitives,