Merge branch 'master' into interlacing-fixes

This commit is contained in:
Josh Holmer 2019-06-27 13:37:32 -04:00 committed by GitHub
commit 0b58f5ff15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -70,3 +70,5 @@ name = "oxipng"
path = "src/lib.rs"
[profile.dev]
opt-level = 2
[profile.release]
lto = true

View file

@ -446,7 +446,7 @@ pub fn optimize_from_memory(data: &[u8], opts: &Options) -> PngResult<Vec<u8>> {
}
}
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, PartialOrd, Clone, Copy)]
/// Defines options to be used for a single compression trial
struct TrialOptions {
pub filter: u8,
@ -636,7 +636,7 @@ fn optimize_png(
}
});
let best: Option<TrialWithData> =
best.reduce_with(|i, j| if i.1.len() <= j.1.len() { i } else { j });
best.reduce_with(|i, j| if i.1.len() < j.1.len() || (i.1.len() == j.1.len() && i.0 < j.0) { i } else { j });
if let Some(better) = best {
png.idat_data = better.1;