Merge pull request #952 from aentity/fix_svg_memory

Use ceil on svg dimensions, fix svg memory usage ref #841
This commit is contained in:
Héctor Ramón 2021-07-21 17:43:37 +07:00 committed by GitHub
commit 14c1e70f66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,8 +75,8 @@ impl Cache {
let id = handle.id(); let id = handle.id();
let (width, height) = ( let (width, height) = (
(scale * width).round() as u32, (scale * width).ceil() as u32,
(scale * height).round() as u32, (scale * height).ceil() as u32,
); );
// TODO: Optimize! // TODO: Optimize!
@ -122,6 +122,7 @@ impl Cache {
device, device,
encoder, encoder,
)?; )?;
log::debug!("allocating {} {}x{}", id, width, height);
let _ = self.svg_hits.insert(id); let _ = self.svg_hits.insert(id);
let _ = self.rasterized_hits.insert((id, width, height)); let _ = self.rasterized_hits.insert((id, width, height));