diff options
author | 2024-05-01 00:55:49 +0200 | |
---|---|---|
committer | 2024-05-01 00:55:49 +0200 | |
commit | 45254ab88c6ca76759523069c2fb8734de626f02 (patch) | |
tree | e5bc22529cfe29398a52f2fbdf5b42416976c6b8 /wgpu | |
parent | 7c084d96958f1dacf9efae1f983bb44086fb70dc (diff) | |
download | iced-45254ab88c6ca76759523069c2fb8734de626f02.tar.gz iced-45254ab88c6ca76759523069c2fb8734de626f02.tar.bz2 iced-45254ab88c6ca76759523069c2fb8734de626f02.zip |
Use `Bytes` as the `Container` of `ImageBuffer`
Since we don't need to mutate images once loaded,
we avoid unnecessary extra allocations.
Diffstat (limited to 'wgpu')
-rw-r--r-- | wgpu/src/image/raster.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs index 7a837f28..60e9cbad 100644 --- a/wgpu/src/image/raster.rs +++ b/wgpu/src/image/raster.rs @@ -10,7 +10,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; #[derive(Debug)] pub enum Memory { /// Image data on host - Host(image_rs::ImageBuffer<image_rs::Rgba<u8>, Vec<u8>>), + Host(image_rs::ImageBuffer<image_rs::Rgba<u8>, image::Bytes>), /// Storage entry Device(atlas::Entry), /// Image not found @@ -51,7 +51,7 @@ impl Cache { } let memory = match graphics::image::load(handle) { - Ok(image) => Memory::Host(image.to_rgba8()), + Ok(image) => Memory::Host(image), Err(image_rs::error::ImageError::IoError(_)) => Memory::NotFound, Err(_) => Memory::Invalid, }; |