This commit is contained in:
Victoria Fischer 2024-11-29 10:58:17 +01:00
parent 9289a829be
commit 26a8924bc8
5 changed files with 15 additions and 15 deletions

View File

@ -46,7 +46,7 @@ impl Default for BoundSurface<Rc<RefCell<ShaderBinding>>>{
impl Surface for BoundSurface<Rc<RefCell<ShaderBinding>>> {
fn rect(&self) -> Rectangle<Virtual> {
self.binding.borrow().rect.clone()
self.binding.borrow().rect
}
fn with_shader<F: FnMut(&dyn Shader)>(&self, mut f: F) {
@ -64,7 +64,7 @@ impl Surface for BoundSurface<Rc<RefCell<ShaderBinding>>> {
}
fn set_rect(&mut self, rect: &Rectangle<Virtual>) {
self.binding.borrow_mut().rect = rect.clone();
self.binding.borrow_mut().rect = *rect;
}
fn opacity(&self) -> u8 {

View File

@ -118,11 +118,11 @@ impl<Space: CoordinateSpace> Rectangle<Space> {
}
pub fn width(&self) -> Space::Data {
self.bottom_right.x.clone() - self.top_left.x.clone()
self.bottom_right.x - self.top_left.x
}
pub fn height(&self) -> Space::Data {
self.bottom_right.y.clone() - self.top_left.y.clone()
self.bottom_right.y - self.top_left.y
}
pub const fn left(&self) -> Space::Data {

View File

@ -17,7 +17,7 @@ pub trait Select<'a> {
}
#[derive(Debug)]
struct LinearCoordView {
pub struct LinearCoordView {
rect: Rectangle<Virtual>,
idx: usize,
}
@ -165,17 +165,17 @@ impl<const STRIDE_NUM: usize> StrideMapping<STRIDE_NUM> {
physical_idx += length as usize;
size = Some(match size.take() {
None => Rectangle::new(
Coordinates::new(x.into(), y.into()),
Coordinates::new(x.into(), (y + length - 1).into()),
Coordinates::new(x, y),
Coordinates::new(x, (y + length - 1)),
),
Some(s) => Rectangle::new(
Coordinates::new(
min(s.top_left.x, x.into()),
min(s.top_left.y, y.into())
min(s.top_left.x, x),
min(s.top_left.y, y)
),
Coordinates::new(
max(s.bottom_right.x, x.into()),
max(s.bottom_right.y, (y + length - 1).into())
max(s.bottom_right.x, x),
max(s.bottom_right.y, (y + length - 1))
)
)
});
@ -260,7 +260,7 @@ impl<'a> StrideView<'a> {
map,
range,
step_size,
cur: range.top_left.clone()
cur: range.top_left
};
}
}
@ -289,7 +289,7 @@ impl<'a> CoordinateView<'a> for StrideView<'a> {
debug_assert!(self.cur.y <= cur_stride.y + cur_stride.length - 1, "coords={:?} out of bounds for stride={:?} view={:?}", self.cur, cur_stride, self);
// Move to the next coord and return
let physical_coords = self.cur.clone();
let physical_coords = self.cur;
self.cur.y += 1;
let virtual_coords = VirtualCoordinates::new(

View File

@ -9,7 +9,7 @@ impl AsMilliwatts for RGB8 {
const RED_MW : u32 = 16 * 5; //< 16mA @ 5v = 80mW
const GREEN_MW : u32 = 11 * 5; //< 11mA @ 5v = 55mW
const BLUE_MW : u32 = 15 * 5; //< 15mA @ 5v = 75mW
const DARK_MW : u32 = 1 * 5; //< 1mA @ 5v = 5mW
const DARK_MW : u32 = 5; //< 1mA @ 5v = 5mW
let red = (self.r as u32 * RED_MW).wrapping_shr(8);
let green = (self.g as u32 * GREEN_MW).wrapping_shr(8);

View File

@ -65,7 +65,7 @@ impl<T: Display<S>, S: Surface> Renderer<T, S> {
display,
fps: RealTimeRunningAverage::default(),
fps_display: Periodically::new_every_n_seconds(5),
_sfc: PhantomData::default()
_sfc: PhantomData
}
}
}