From ca4da33dd705e10df9d8c5cf77bfb7df4a4fc818 Mon Sep 17 00:00:00 2001 From: Alan Race Date: Mon, 2 May 2022 15:39:14 +0200 Subject: [PATCH] Mirrored return value of `read_tile` to `read_strip` --- src/decoder/mod.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 1378852..c80197f 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -1213,22 +1213,16 @@ impl Decoder { } /// Read a single strip from the image and return it as a Vector - pub fn read_strip(&mut self) -> TiffResult { + pub fn read_strip(&mut self) -> TiffResult<(DecodingResult, ChunkInfo)> { self.check_chunk_type(ChunkType::Strip)?; let index = self.current_chunk; - let rows_per_strip = - usize::try_from(self.image().strip_decoder.as_ref().unwrap().rows_per_strip)?; + let chunk_info = self.chunk_info(index).unwrap(); - let strip_height = cmp::min( - 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)?; + let mut result = self.result_buffer(chunk_info.data_width, chunk_info.data_height)?; 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