Simplify layout proxy methods
This commit is contained in:
1 parent
0de1261948
commit
6fe21da979
2 files changed
+5
-16
No files matched your search
@@ -606,20 +606,6 @@ impl Image {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the layout for each output plane (i.e. one plane for non-planar tiff).
|
||||
pub(crate) fn preferred_output_layout(&self) -> TiffResult<PlaneLayout> {
|
||||
let Image { width, height, .. } = *self;
|
||||
self.preferred_output_layout_for(width, height)
|
||||
}
|
||||
|
||||
pub(crate) fn preferred_output_layout_for(
|
||||
&self,
|
||||
width: u32,
|
||||
height: u32,
|
||||
) -> TiffResult<PlaneLayout> {
|
||||
self.readout_for_size(width, height)?.to_plane_layout()
|
||||
}
|
||||
|
||||
pub(crate) fn readout_for_image(&self) -> TiffResult<ReadoutLayout> {
|
||||
let Image { width, height, .. } = *self;
|
||||
self.readout_for_size(width, height)
|
||||
|
||||
+5
-2
@@ -1136,9 +1136,12 @@ impl<R: Read + Seek> Decoder<R> {
|
||||
}
|
||||
|
||||
let data_dims = self.image().chunk_data_dimensions(chunk_index)?;
|
||||
|
||||
let layout = self
|
||||
.image()
|
||||
.preferred_output_layout_for(data_dims.0, data_dims.1)?;
|
||||
.readout_for_size(data_dims.0, data_dims.1)?
|
||||
.to_plane_layout()?;
|
||||
|
||||
Ok(BufferLayoutPreference::from_planes(&layout))
|
||||
}
|
||||
|
||||
@@ -1212,7 +1215,7 @@ impl<R: Read + Seek> Decoder<R> {
|
||||
/// indicate the layout needed to read the first data plane. This will be fixed in a future
|
||||
/// major version of `tiff`.
|
||||
pub fn image_buffer_layout(&mut self) -> TiffResult<BufferLayoutPreference> {
|
||||
let layout = self.image().preferred_output_layout()?;
|
||||
let layout = self.image().readout_for_image()?.to_plane_layout()?;
|
||||
Ok(BufferLayoutPreference::from_planes(&layout))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user