OH MY GOSH A TEST PASSED

This commit is contained in:
Joshua Holmer 2016-02-19 15:24:43 -05:00
parent e1d30163c2
commit 6c355b0c83

View file

@ -886,7 +886,7 @@ fn reduce_palette_to_grayscale(png: &PngData) -> Option<Vec<u8>> {
// At the end of each pixel, push its grayscale value onto the reduced image
cur_pixel.push(bit);
if cur_pixel.len() == bit_depth {
let palette_idx: usize = ((cur_pixel.to_bytes()[0]) * 3) as usize;
let palette_idx: usize = cur_pixel.to_bytes()[0] as usize * 3;
reduced.extend(BitVec::from_bytes(&[palette[palette_idx]]));
// BitVec's clear function doesn't set len to 0
cur_pixel = BitVec::with_capacity(bit_depth);