Add support for loading already-decoded image pixels
This commit is contained in:
parent
96f75eae4d
commit
1841015428
2 changed files with 41 additions and 0 deletions
|
|
@ -55,6 +55,21 @@ impl Cache {
|
|||
Memory::Invalid
|
||||
}
|
||||
}
|
||||
image::Data::Pixels {
|
||||
width,
|
||||
height,
|
||||
pixels,
|
||||
} => {
|
||||
if let Some(image) = ::image::ImageBuffer::from_vec(
|
||||
*width,
|
||||
*height,
|
||||
pixels.to_vec(),
|
||||
) {
|
||||
Memory::Host(image)
|
||||
} else {
|
||||
Memory::Invalid
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.insert(handle, memory);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue