mappings: drop a rect clone when we only need the x coord for a linear map
This commit is contained in:
parent
bbdb3d7404
commit
c9496e3dc3
@ -20,7 +20,7 @@ pub trait Select<'a> {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct LinearCoordView {
|
pub struct LinearCoordView {
|
||||||
rect: Rectangle<Virtual>,
|
max_x: u8,
|
||||||
idx: usize,
|
idx: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ pub type LinearCoords = Coordinates<LinearSpace>;
|
|||||||
impl<'a> CoordinateView<'a> for LinearCoordView {
|
impl<'a> CoordinateView<'a> for LinearCoordView {
|
||||||
type Space = LinearSpace;
|
type Space = LinearSpace;
|
||||||
fn next(&mut self) -> Option<(VirtualCoordinates, LinearCoords)> {
|
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
|
None
|
||||||
} else {
|
} else {
|
||||||
let virt = VirtualCoordinates::new(self.idx as u8, 0); // FIXME: scale8
|
let virt = VirtualCoordinates::new(self.idx as u8, 0); // FIXME: scale8
|
||||||
@ -62,7 +62,7 @@ impl<'a> Select<'a> for LinearPixelMapping {
|
|||||||
type View = LinearCoordView;
|
type View = LinearCoordView;
|
||||||
fn select(&'a self, rect: &Rectangle<Virtual>) -> Self::View {
|
fn select(&'a self, rect: &Rectangle<Virtual>) -> Self::View {
|
||||||
LinearCoordView {
|
LinearCoordView {
|
||||||
rect: rect.clone(),
|
max_x: rect.bottom_right.x,
|
||||||
idx: 0,
|
idx: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user