fix(libkos): as_chunks for canvas pixels (clippy)
This commit is contained in:
@@ -125,8 +125,8 @@ impl Canvas {
|
|||||||
/// Fills `len` pixels from byte `at` with `color`.
|
/// Fills `len` pixels from byte `at` with `color`.
|
||||||
fn fill(&mut self, at: usize, len: usize, color: Color) {
|
fn fill(&mut self, at: usize, len: usize, color: Color) {
|
||||||
let px = color.to_rgba();
|
let px = color.to_rgba();
|
||||||
for chunk in self.pixels[at..at + len * PIXEL_BYTES].chunks_exact_mut(PIXEL_BYTES) {
|
for chunk in self.pixels[at..at + len * PIXEL_BYTES].as_chunks_mut::<PIXEL_BYTES>().0 {
|
||||||
chunk.copy_from_slice(&px);
|
*chunk = px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,8 +148,8 @@ impl port_framebuffer::Framebuffer for Canvas {
|
|||||||
let len = Dimension::new(row.len().min(u16::MAX as usize) as u16);
|
let len = Dimension::new(row.len().min(u16::MAX as usize) as u16);
|
||||||
let Some((cx, cy, w, _)) = self.clip(x, y, len, Dimension::new(1)) else { return };
|
let Some((cx, cy, w, _)) = self.clip(x, y, len, Dimension::new(1)) else { return };
|
||||||
let at = self.offset(cx, cy);
|
let at = self.offset(cx, cy);
|
||||||
for (chunk, c) in self.pixels[at..at + w as usize * PIXEL_BYTES].chunks_exact_mut(PIXEL_BYTES).zip(row) {
|
for (chunk, c) in self.pixels[at..at + w as usize * PIXEL_BYTES].as_chunks_mut::<PIXEL_BYTES>().0.iter_mut().zip(row) {
|
||||||
chunk.copy_from_slice(&c.to_rgba());
|
*chunk = c.to_rgba();
|
||||||
}
|
}
|
||||||
self.touch(x, y, len, Dimension::new(1));
|
self.touch(x, y, len, Dimension::new(1));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user