Rename Fonts::end_frame to Fonts::prune_cache

This commit is contained in:
Emil Ernerfeldt 2021-11-03 22:23:52 +01:00
parent d8519b3281
commit 66eb2fb5f7
2 changed files with 5 additions and 5 deletions

View file

@ -627,7 +627,7 @@ impl Context {
self.memory() self.memory()
.end_frame(&self.input, &self.frame_state().used_ids); .end_frame(&self.input, &self.frame_state().used_ids);
self.fonts().end_frame(); self.fonts().prune_cache();
let mut output: Output = std::mem::take(&mut self.output()); let mut output: Output = std::mem::take(&mut self.output());
if self.repaint_requests.load(SeqCst) > 0 { if self.repaint_requests.load(SeqCst) > 0 {

View file

@ -398,8 +398,8 @@ impl Fonts {
} }
/// Must be called once per frame to clear the [`Galley`] cache. /// Must be called once per frame to clear the [`Galley`] cache.
pub fn end_frame(&self) { pub fn prune_cache(&self) {
self.galley_cache.lock().end_frame(); self.galley_cache.lock().prune();
} }
} }
@ -453,8 +453,8 @@ impl GalleyCache {
self.cache.len() self.cache.len()
} }
/// Must be called once per frame to clear the [`Galley`] cache. /// Must be called once per frame to prune the [`Galley`] cache.
pub fn end_frame(&mut self) { pub fn prune(&mut self) {
let current_generation = self.generation; let current_generation = self.generation;
self.cache.retain(|_key, cached| { self.cache.retain(|_key, cached| {
cached.last_used == current_generation // only keep those that were used this frame cached.last_used == current_generation // only keep those that were used this frame