fn init(&mut self) -> Result<(), DecodingError> {
        use crate::Decoded::*;
        if self.decoder.info().is_some() {
            Ok(())
        } else {
            loop {
                match self.decoder.decode_next(&mut Vec::new())? {
                    Some(ChunkBegin(_, IDAT)) => break,
                    None => return Err(DecodingError::Format("IDAT chunk missing".into())),
                    _ => (),
                }
            }
            {
                let info = match self.decoder.info() {
                    Some(info) => info,
                    None => return Err(DecodingError::Format("IHDR chunk missing".into())),
                };
                self.bpp = info.bytes_per_pixel();
                self.rowlen = info.raw_row_length();
                self.interlace = if info.interlaced {
                    InterlaceIter::Adam7(utils::Adam7Iterator::new(info.width, info.height))
                } else {
                    InterlaceIter::None(0..info.height)
                }
            }
            self.allocate_out_buf()?;
            self.prev = vec![0; self.rowlen];
            Ok(())
        }
    }
/// Reads all meta data until the first IDAT chunk
Reads all meta data until the first IDAT chunk
Reads all meta data until the first IDAT chunk
fn init(&mut self) -> Result<(), DecodingError> {
        use crate::Decoded::*;
        if self.decoder.info().is_some() {
            Ok(())
        } else {
            loop {
                match self.decoder.decode_next(&mut Vec::new())? {
                    Some(ChunkBegin(_, IDAT)) => break,
                    None => return Err(DecodingError::Format("IDAT chunk missing".into())),
                    _ => (),
                }
            }
            {
                let info = match self.decoder.info() {
                    Some(info) => info,
                    None => return Err(DecodingError::Format("IHDR chunk missing".into())),
                };
                self.bpp = info.bytes_per_pixel();
                self.rowlen = info.raw_row_length();
                self.interlace = if info.interlaced {
                    InterlaceIter::Adam7(utils::Adam7Iterator::new(info.width, info.height))
                } else {
                    InterlaceIter::None(0..info.height)
                }
            }
            self.allocate_out_buf()?;
            self.prev = vec![0; self.rowlen];
            Ok(())
        }
    }
fn init ( & mut self ) -> Result < ( ) , DecodingError > { use crate :: Decoded :: * ; if self . decoder . info ( ) . is_some ( ) { Ok ( ( ) ) } else { loop { match self . decoder . decode_next ( & mut Vec :: new ( ) ) ? { Some ( ChunkBegin ( _ , IDAT ) ) => break , None => return Err ( DecodingError :: Format ( " " . into ( ) ) ) , _ => ( ) , } } { let info = match self . decoder . info ( ) { Some ( info ) => info , None => return Err ( DecodingError :: Format ( " " . into ( ) ) ) , } ; self . bpp = info . bytes_per_pixel ( ) ; self . rowlen = info . raw_row_length ( ) ; self . interlace = if info . interlaced { InterlaceIter :: Adam7 ( utils :: Adam7Iterator :: new ( info . width , info . height ) ) } else { InterlaceIter :: None ( 0 .. info . height ) } } self . allocate_out_buf ( ) ? ; self . prev = vec ! [ 0 self rowlen ] ; Ok ( ( ) ) } }
Reads all meta data until the first IDAT chunk
Reads all meta data until the first IDAT chunk
&mut self
&mut self