diff --git a/src/mappings.rs b/src/mappings.rs index 0166426..a4fd1fc 100644 --- a/src/mappings.rs +++ b/src/mappings.rs @@ -20,7 +20,7 @@ pub trait Select<'a> { #[derive(Debug)] pub struct LinearCoordView { - rect: Rectangle, + max_x: u8, idx: usize, } @@ -34,7 +34,7 @@ pub type LinearCoords = Coordinates; impl<'a> CoordinateView<'a> for LinearCoordView { type Space = LinearSpace; fn next(&mut self) -> Option<(VirtualCoordinates, LinearCoords)> { - if self.idx as u8 == self.rect.bottom_right.x { + if self.idx as u8 == self.max_x { None } else { let virt = VirtualCoordinates::new(self.idx as u8, 0); // FIXME: scale8 @@ -62,7 +62,7 @@ impl<'a> Select<'a> for LinearPixelMapping { type View = LinearCoordView; fn select(&'a self, rect: &Rectangle) -> Self::View { LinearCoordView { - rect: rect.clone(), + max_x: rect.bottom_right.x, idx: 0, } }