Avoid vec allocation per pixel
This commit is contained in:
parent
61cc47d506
commit
84c045e150
1 changed files with 8 additions and 4 deletions
12
src/lib.rs
12
src/lib.rs
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue