Remove Decoder::byte_order

This commit is contained in:
Jonathan Behrens committed 2022-01-12 19:50:06 -05:00
1 parent 4c942ca690
commit 2d572c0370
1 file changed
+3 -4
+3 -4
View File
@@ -361,7 +361,6 @@ where
R: Read + Seek, R: Read + Seek,
{ {
reader: SmartReader<R>, reader: SmartReader<R>,
byte_order: ByteOrder,
bigtiff: bool, bigtiff: bool,
limits: Limits, limits: Limits,
next_ifd: Option<u64>, next_ifd: Option<u64>,
@@ -575,7 +574,6 @@ impl<R: Read + Seek> Decoder<R> {
let mut decoder = Decoder { let mut decoder = Decoder {
reader, reader,
byte_order,
bigtiff, bigtiff,
limits: Default::default(), limits: Default::default(),
next_ifd, next_ifd,
@@ -810,7 +808,7 @@ impl<R: Read + Seek> Decoder<R> {
/// Returns the byte_order /// Returns the byte_order
pub fn byte_order(&self) -> ByteOrder { pub fn byte_order(&self) -> ByteOrder {
self.byte_order self.reader.byte_order
} }
fn read_ifd_offset_nonrepeating(&mut self) -> TiffResult<u64> { fn read_ifd_offset_nonrepeating(&mut self) -> TiffResult<u64> {
@@ -1257,6 +1255,7 @@ impl<R: Read + Seek> Decoder<R> {
) -> TiffResult<()> { ) -> TiffResult<()> {
let color_type = self.colortype()?; let color_type = self.colortype()?;
let byte_len = buffer.byte_len(); let byte_len = buffer.byte_len();
let byte_order = self.reader.byte_order;
let tile_attrs = self.tile_attributes.as_mut().unwrap(); let tile_attrs = self.tile_attributes.as_mut().unwrap();
let (padding_right, padding_down) = tile_attrs.get_padding(tile); let (padding_right, padding_down) = tile_attrs.get_padding(tile);
@@ -1304,7 +1303,7 @@ impl<R: Read + Seek> Decoder<R> {
io::copy(&mut reader.by_ref().take(len), &mut io::sink())?; io::copy(&mut reader.by_ref().take(len), &mut io::sink())?;
} }
Self::fix_endianness(&mut buffer.subrange(row_start..row_end), self.byte_order); Self::fix_endianness(&mut buffer.subrange(row_start..row_end), byte_order);
if self.photometric_interpretation == PhotometricInterpretation::WhiteIsZero { if self.photometric_interpretation == PhotometricInterpretation::WhiteIsZero {
Self::invert_colors(&mut buffer.subrange(row_start..row_end), color_type); Self::invert_colors(&mut buffer.subrange(row_start..row_end), color_type);