Cache Svg load result properly
This avoids trying to reload the file constantly on every frame.
This commit is contained in:
parent
232d4873ba
commit
514ccf8a72
2 changed files with 22 additions and 20 deletions
|
|
@ -215,12 +215,9 @@ impl Pipeline {
|
|||
#[cfg(feature = "svg")]
|
||||
pub fn viewport_dimensions(&self, handle: &svg::Handle) -> (u32, u32) {
|
||||
let mut cache = self.vector_cache.borrow_mut();
|
||||
let svg = cache.load(&handle);
|
||||
|
||||
if let Some(svg) = cache.load(&handle) {
|
||||
svg.viewport_dimensions()
|
||||
} else {
|
||||
(1, 1)
|
||||
}
|
||||
svg.viewport_dimensions()
|
||||
}
|
||||
|
||||
pub fn draw(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue