diff options
author | 2024-05-01 06:57:38 +0200 | |
---|---|---|
committer | 2024-05-01 06:57:38 +0200 | |
commit | a11784f9edfd5668fa998b2a7d2a50971a4cdac5 (patch) | |
tree | 0ec25d8bcbf4bff4bf7e9ee9c9e462ef2f47af3a /wgpu/src/image | |
parent | 89892f1760d4ec67f458d67ae722c3f06d524a1b (diff) | |
parent | 01b014c19fa2a3c200fb2077e31822f525f729cf (diff) | |
download | iced-a11784f9edfd5668fa998b2a7d2a50971a4cdac5.tar.gz iced-a11784f9edfd5668fa998b2a7d2a50971a4cdac5.tar.bz2 iced-a11784f9edfd5668fa998b2a7d2a50971a4cdac5.zip |
Merge pull request #2356 from Bajix/feature/bytes
Utilize bytes::Bytes for images
Diffstat (limited to 'wgpu/src/image')
-rw-r--r-- | wgpu/src/image/raster.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs index 7a837f28..4d3c3125 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 @@ -38,8 +38,8 @@ impl Memory { /// Caches image raster data #[derive(Debug, Default)] pub struct Cache { - map: FxHashMap<u64, Memory>, - hits: FxHashSet<u64>, + map: FxHashMap<image::Id, Memory>, + hits: FxHashSet<image::Id>, should_trim: bool, } @@ -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, }; |