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

Method draw_iter

user/src/io.rs:51–68  ·  view source on GitHub ↗
(&mut self, pixels: I)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

framebuffer_flushFunction · 0.85
lenMethod · 0.80
into_iterMethod · 0.45

Tested by

no test coverage detected