Mirrored return value of read_tile to read_strip

This commit is contained in:
Alan Race committed 2022-05-09 09:16:35 +02:00
1 parent 6d4c4a49a1
commit ca4da33dd7
1 file changed
+4 -10
+4 -10
View File
@@ -1213,22 +1213,16 @@ impl<R: Read + Seek> Decoder<R> {
} }
/// Read a single strip from the image and return it as a Vector /// Read a single strip from the image and return it as a Vector
pub fn read_strip(&mut self) -> TiffResult<DecodingResult> { pub fn read_strip(&mut self) -> TiffResult<(DecodingResult, ChunkInfo)> {
self.check_chunk_type(ChunkType::Strip)?; self.check_chunk_type(ChunkType::Strip)?;
let index = self.current_chunk; let index = self.current_chunk;
let rows_per_strip = let chunk_info = self.chunk_info(index).unwrap();
usize::try_from(self.image().strip_decoder.as_ref().unwrap().rows_per_strip)?;
let strip_height = cmp::min( let mut result = self.result_buffer(chunk_info.data_width, chunk_info.data_height)?;
rows_per_strip,
usize::try_from(self.image().height)? - index * rows_per_strip,
);
let mut result = self.result_buffer(usize::try_from(self.image().width)?, strip_height)?;
self.read_strip_to_buffer(result.as_buffer(0))?; self.read_strip_to_buffer(result.as_buffer(0))?;
Ok(result) Ok((result, chunk_info))
} }
/// Read a single tile from the image and return it as a Vector /// Read a single tile from the image and return it as a Vector