Add plane selection to allocating result_extent

This commit is contained in:
A. Molzer committed 2025-11-26 19:18:27 +01:00
1 parent 58543962f3
commit 5d3a5242ea
4 files changed
+109 -85

No files matched your search

+5 -8
View File
@@ -1019,19 +1019,16 @@ impl ReadoutLayout {
let num_planes = self.color.num_samples() / self.samples_per_out_texel();
// Using the standard range iterator as checked_add on steroids.
let mut offset = 0..=usize::MAX;
//
// Note: for supporting subsampling, adjust as required.
let mut offset = (0..=usize::MAX).step_by(self.plane_stride);
let plane_offsets = offset
.by_ref()
// Note: for supporting subsampling, adjust as required.
.step_by(self.plane_stride)
.take(usize::from(num_planes))
.collect();
let plane_offsets = offset.by_ref().take(usize::from(num_planes)).collect();
// Get the past-the-end of the last plane.
//
// This also verifies the `take` above was not short.
let Some(total_bytes) = offset.nth(self.plane_stride) else {
let Some(total_bytes) = offset.next() else {
return Err(TiffError::LimitsExceeded);
};