diff options
author | 2021-07-13 22:27:48 -0400 | |
---|---|---|
committer | 2021-07-21 02:26:53 -0400 | |
commit | 665422e256b5eb8fed23f1a13900838e0e3bcb44 (patch) | |
tree | 465d0e9ff1014e30c5e2a7fd2d2deb3096cc437f /wgpu | |
parent | 27b42ca6b6585477fda0a5d07ec09bd74e501a1a (diff) | |
download | iced-665422e256b5eb8fed23f1a13900838e0e3bcb44.tar.gz iced-665422e256b5eb8fed23f1a13900838e0e3bcb44.tar.bz2 iced-665422e256b5eb8fed23f1a13900838e0e3bcb44.zip |
Use ceil on svg dimensions, fix svg memory usage
Calls ceil() on dimension bounds as this appears fix svg memory
unbounded usage because no longer cache miss.
The height and width return from resvg seem to always be ceiling
of float dimensions, so we try to match.
Diffstat (limited to 'wgpu')
-rw-r--r-- | wgpu/src/image/vector.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/wgpu/src/image/vector.rs b/wgpu/src/image/vector.rs index 8c7de617..cd511a45 100644 --- a/wgpu/src/image/vector.rs +++ b/wgpu/src/image/vector.rs @@ -75,8 +75,8 @@ impl Cache { let id = handle.id(); let (width, height) = ( - (scale * width).round() as u32, - (scale * height).round() as u32, + (scale * width).ceil() as u32, + (scale * height).ceil() as u32, ); // TODO: Optimize! @@ -122,6 +122,7 @@ impl Cache { device, encoder, )?; + log::debug!("allocating {} {}x{}", id, width, height); let _ = self.svg_hits.insert(id); let _ = self.rasterized_hits.insert((id, width, height)); |