Run rustfmt
This commit is contained in:
parent
9d94e39a0e
commit
04dcdb41ab
3 changed files with 10 additions and 8 deletions
|
|
@ -1,9 +1,9 @@
|
|||
use std::io;
|
||||
use crate::colors::{BitDepth, ColorType};
|
||||
use crate::error::PngError;
|
||||
use crate::PngResult;
|
||||
use crc::{Crc, CRC_32_ISO_HDLC};
|
||||
use indexmap::IndexSet;
|
||||
use std::io;
|
||||
use std::io::{Cursor, Read};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
@ -163,10 +163,8 @@ pub fn parse_ihdr_header(byte_data: &[u8]) -> PngResult<IhdrData> {
|
|||
16 => BitDepth::Sixteen,
|
||||
_ => return Err(PngError::new("Unexpected bit depth in header")),
|
||||
},
|
||||
width: read_be_u32(&mut rdr)
|
||||
.map_err(|_| PngError::TruncatedData)?,
|
||||
height: read_be_u32(&mut rdr)
|
||||
.map_err(|_| PngError::TruncatedData)?,
|
||||
width: read_be_u32(&mut rdr).map_err(|_| PngError::TruncatedData)?,
|
||||
height: read_be_u32(&mut rdr).map_err(|_| PngError::TruncatedData)?,
|
||||
compression: byte_data[10],
|
||||
filter: byte_data[11],
|
||||
interlaced,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ use log::{debug, error, info, warn};
|
|||
use rayon::prelude::*;
|
||||
use std::fmt;
|
||||
use std::fs::{copy, File, Metadata};
|
||||
use std::io::{stdin, stdout, BufWriter, Read, Write, Cursor};
|
||||
use std::io::{stdin, stdout, BufWriter, Cursor, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -175,9 +175,13 @@ impl PngData {
|
|||
// IHDR
|
||||
let mut ihdr_data = Vec::with_capacity(13);
|
||||
ihdr_data.write_all(&self.raw.ihdr.width.to_be_bytes()).ok();
|
||||
ihdr_data.write_all(&self.raw.ihdr.height.to_be_bytes()).ok();
|
||||
ihdr_data
|
||||
.write_all(&self.raw.ihdr.height.to_be_bytes())
|
||||
.ok();
|
||||
ihdr_data.write_all(&[self.raw.ihdr.bit_depth.as_u8()]).ok();
|
||||
ihdr_data.write_all(&[self.raw.ihdr.color_type.png_header_code()]).ok();
|
||||
ihdr_data
|
||||
.write_all(&[self.raw.ihdr.color_type.png_header_code()])
|
||||
.ok();
|
||||
ihdr_data.write_all(&[0]).ok(); // Compression -- deflate
|
||||
ihdr_data.write_all(&[0]).ok(); // Filter method -- 5-way adaptive filtering
|
||||
ihdr_data.write_all(&[self.raw.ihdr.interlaced]).ok();
|
||||
|
|
|
|||
Loading…
Reference in a new issue