Avoid vec allocation per pixel

This commit is contained in:
Kornel 2018-09-15 11:50:54 +01:00
parent 61cc47d506
commit 84c045e150

View file

@ -905,11 +905,15 @@ fn copy_permissions(input_path: &Path, out_file: &File, verbosity: Option<u8>) {
fn images_equal(old_png: &DynamicImage, new_png: &DynamicImage) -> bool { fn images_equal(old_png: &DynamicImage, new_png: &DynamicImage) -> bool {
let a = old_png let a = old_png
.pixels() .pixels()
.map(|x| x.2.channels().to_owned()) .filter(|x| {
.filter(|p| !(p.len() == 4 && p[3] == 0)); let p = x.2.channels();
!(p.len() == 4 && p[3] == 0)
});
let b = new_png let b = new_png
.pixels() .pixels()
.map(|x| x.2.channels().to_owned()) .filter(|x| {
.filter(|p| !(p.len() == 4 && p[3] == 0)); let p = x.2.channels();
!(p.len() == 4 && p[3] == 0)
});
a.eq(b) a.eq(b)
} }