Update png to 0.18

This commit is contained in:
Héctor Ramón Jiménez 2025-09-08 05:40:31 +02:00
parent cb9b106ff8
commit 354159bdf4
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 9 additions and 6 deletions

View file

@ -494,10 +494,13 @@ impl Snapshot {
if path.exists() {
let file = fs::File::open(&path)?;
let decoder = png::Decoder::new(file);
let decoder = png::Decoder::new(io::BufReader::new(file));
let mut reader = decoder.read_info()?;
let mut bytes = vec![0; reader.output_buffer_size()];
let n = reader
.output_buffer_size()
.expect("snapshot should fit in memory");
let mut bytes = vec![0; n];
let info = reader.next_frame(&mut bytes)?;
Ok(self.screenshot.bytes == bytes[..info.buffer_size()])