Always run palette reduction even if there's only one entry

This commit is contained in:
Andrew 2024-03-28 18:21:10 +13:00 committed by andrews05
parent 1ddab42edb
commit fca76a7afb

View file

@ -14,9 +14,8 @@ pub fn reduced_palette(png: &PngImage, optimize_alpha: bool) -> Option<PngImage>
if png.ihdr.bit_depth != BitDepth::Eight { if png.ihdr.bit_depth != BitDepth::Eight {
return None; return None;
} }
let palette = match &png.ihdr.color_type { let ColorType::Indexed { palette } = &png.ihdr.color_type else {
ColorType::Indexed { palette } if palette.len() > 1 => palette, return None;
_ => return None,
}; };
let mut used = [false; 256]; let mut used = [false; 256];