From 7f02f78c788485d51d65758784cb730db0798f23 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 29 Nov 2022 16:59:33 +1300 Subject: [PATCH] Check entire palette map --- src/reduction/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/reduction/mod.rs b/src/reduction/mod.rs index 8fd258f7..0c56b89c 100644 --- a/src/reduction/mod.rs +++ b/src/reduction/mod.rs @@ -144,8 +144,7 @@ fn do_palette_reduction(png: &PngImage, palette_map: &[Option; 256]) -> Opti } fn palette_map_to_byte_map(png: &PngImage, palette_map: &[Option; 256]) -> Option<[u8; 256]> { - let len = png.palette.as_ref().map_or(0, |p| p.len()); - if (0..len).all(|i| palette_map[i].map_or(true, |to| to == i as u8)) { + if (0..256).all(|i| palette_map[i].map_or(true, |to| to == i as u8)) { // No reduction necessary return None; }