summaryrefslogtreecommitdiffstats
path: root/tiny_skia/src/raster.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tiny_skia/src/raster.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tiny_skia/src/raster.rs b/tiny_skia/src/raster.rs
index e57f0e50..2fd73f8c 100644
--- a/tiny_skia/src/raster.rs
+++ b/tiny_skia/src/raster.rs
@@ -52,6 +52,10 @@ impl Pipeline {
);
}
}
+
+ pub fn trim_cache(&mut self) {
+ self.cache.borrow_mut().trim();
+ }
}
#[derive(Default)]
@@ -98,6 +102,11 @@ impl Cache {
.expect("Build pixmap from image bytes")
})
}
+
+ fn trim(&mut self) {
+ self.entries.retain(|key, _| self.hits.contains(key));
+ self.hits.clear();
+ }
}
struct Entry {