summaryrefslogtreecommitdiffstats
path: root/wgpu/src/image/raster.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-05-01 00:55:49 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-05-01 00:55:49 +0200
commit45254ab88c6ca76759523069c2fb8734de626f02 (patch)
treee5bc22529cfe29398a52f2fbdf5b42416976c6b8 /wgpu/src/image/raster.rs
parent7c084d96958f1dacf9efae1f983bb44086fb70dc (diff)
downloadiced-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 '')
-rw-r--r--wgpu/src/image/raster.rs4
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,
};