mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-07 13:23:37 +00:00
address review: charge declared image pixels before decode
This commit is contained in:
@@ -1058,9 +1058,10 @@ impl<'a> Interp<'a> {
|
||||
self.b.skip("image (page pixel limit)");
|
||||
return;
|
||||
};
|
||||
// Charged even when the decode fails: the declared size is what costs.
|
||||
self.image_pixels = left;
|
||||
match crate::image::decode(self.file, d, raw, Some(res), fill) {
|
||||
Ok(img) => {
|
||||
self.image_pixels = left;
|
||||
let decoded = (img.width, img.height, std::sync::Arc::new(img.rgba));
|
||||
if let Some(k) = cache_key {
|
||||
self.images.insert(k, decoded.clone());
|
||||
|
||||
Reference in New Issue
Block a user