small fix
This commit is contained in:
parent
91a18ebe97
commit
286aaffa31
4 changed files with 5 additions and 5 deletions
|
|
@ -9,13 +9,13 @@ pub struct AtomicMin {
|
||||||
impl AtomicMin {
|
impl AtomicMin {
|
||||||
pub fn new(init: Option<usize>) -> Self {
|
pub fn new(init: Option<usize>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
val: AtomicUsize::new(init.unwrap_or(usize::max_value())),
|
val: AtomicUsize::new(init.unwrap_or(usize::MAX)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&self) -> Option<usize> {
|
pub fn get(&self) -> Option<usize> {
|
||||||
let val = self.val.load(SeqCst);
|
let val = self.val.load(SeqCst);
|
||||||
if val == usize::max_value() {
|
if val == usize::MAX {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(val)
|
Some(val)
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ impl PngImage {
|
||||||
// http://www.libpng.org/pub/png/book/chapter09.html
|
// http://www.libpng.org/pub/png/book/chapter09.html
|
||||||
let mut best_filter = 0;
|
let mut best_filter = 0;
|
||||||
let mut best_line = Vec::new();
|
let mut best_line = Vec::new();
|
||||||
let mut best_size = std::u64::MAX;
|
let mut best_size = u64::MAX;
|
||||||
|
|
||||||
// Avoid vertical filtering on first line of each interlacing pass
|
// Avoid vertical filtering on first line of each interlacing pass
|
||||||
for filter in if last_pass == line.pass { 0..5 } else { 0..2 } {
|
for filter in if last_pass == line.pass { 0..5 } else { 0..2 } {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ fn test_it_converts(
|
||||||
if let Some(palette) = png.raw.palette.as_ref() {
|
if let Some(palette) = png.raw.palette.as_ref() {
|
||||||
assert!(palette.len() <= 1 << (png.raw.ihdr.bit_depth.as_u8() as usize));
|
assert!(palette.len() <= 1 << (png.raw.ihdr.bit_depth.as_u8() as usize));
|
||||||
} else {
|
} else {
|
||||||
assert!(png.raw.ihdr.color_type != ColorType::Indexed);
|
assert_ne!(png.raw.ihdr.color_type, ColorType::Indexed);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_file(output).ok();
|
remove_file(output).ok();
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ fn test_it_converts(
|
||||||
if let Some(palette) = png.raw.palette.as_ref() {
|
if let Some(palette) = png.raw.palette.as_ref() {
|
||||||
assert!(palette.len() <= 1 << (png.raw.ihdr.bit_depth.as_u8() as usize));
|
assert!(palette.len() <= 1 << (png.raw.ihdr.bit_depth.as_u8() as usize));
|
||||||
} else {
|
} else {
|
||||||
assert!(png.raw.ihdr.color_type != ColorType::Indexed);
|
assert_ne!(png.raw.ihdr.color_type, ColorType::Indexed);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_file(output).ok();
|
remove_file(output).ok();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue