MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / draw_iter

Method draw_iter

user/src/bin/gui_uart.rs:56–73  ·  view source on GitHub ↗
(&mut self, pixels: I)

Source from the content-addressed store, hash-verified

54 type Error = core::convert::Infallible;
55
56 fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
57 where
58 I: IntoIterator<Item = embedded_graphics::Pixel<Self::Color>>,
59 {
60 pixels.into_iter().for_each(|px| {
61 let idx = ((self.point.y + px.0.y) * VIRTGPU_XRES as i32 + self.point.x + px.0.x)
62 as usize
63 * 4;
64 if idx + 2 >= self.fb.len() {
65 return;
66 }
67 self.fb[idx] = px.1.b();
68 self.fb[idx + 1] = px.1.g();
69 self.fb[idx + 2] = px.1.r();
70 });
71 framebuffer_flush();
72 Ok(())
73 }
74}
75
76pub struct DrawingBoard {

Callers

nothing calls this directly

Calls 3

framebuffer_flushFunction · 0.85
lenMethod · 0.80
into_iterMethod · 0.45

Tested by

no test coverage detected