Trim raster cache in iced_tiny_skia
This commit is contained in:
parent
5b3977daf6
commit
a8d55ceb82
2 changed files with 12 additions and 0 deletions
|
|
@ -86,6 +86,9 @@ impl Backend {
|
||||||
|
|
||||||
self.text_pipeline.trim_cache();
|
self.text_pipeline.trim_cache();
|
||||||
|
|
||||||
|
#[cfg(feature = "image")]
|
||||||
|
self.raster_pipeline.trim_cache();
|
||||||
|
|
||||||
#[cfg(feature = "svg")]
|
#[cfg(feature = "svg")]
|
||||||
self.vector_pipeline.trim_cache();
|
self.vector_pipeline.trim_cache();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@ impl Pipeline {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn trim_cache(&mut self) {
|
||||||
|
self.cache.borrow_mut().trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
|
@ -98,6 +102,11 @@ impl Cache {
|
||||||
.expect("Build pixmap from image bytes")
|
.expect("Build pixmap from image bytes")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn trim(&mut self) {
|
||||||
|
self.entries.retain(|key, _| self.hits.contains(key));
|
||||||
|
self.hits.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue