Use Bytes as the Container of ImageBuffer
Since we don't need to mutate images once loaded, we avoid unnecessary extra allocations.
This commit is contained in:
parent
7c084d9695
commit
45254ab88c
5 changed files with 105 additions and 109 deletions
|
|
@ -83,7 +83,7 @@ impl Cache {
|
|||
let id = handle.id();
|
||||
|
||||
if let hash_map::Entry::Vacant(entry) = self.entries.entry(id) {
|
||||
let image = graphics::image::load(handle).ok()?.into_rgba8();
|
||||
let image = graphics::image::load(handle).ok()?;
|
||||
|
||||
let mut buffer =
|
||||
vec![0u32; image.width() as usize * image.height() as usize];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue