From 12ba96bc05223a36995d64b1b0700449ee7bee15 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 5 Sep 2019 00:22:18 +0200 Subject: [PATCH] l0dable: optimize framebuffer embedded-graphics drawing --- card10-l0dable/src/framebuffer/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/card10-l0dable/src/framebuffer/mod.rs b/card10-l0dable/src/framebuffer/mod.rs index 91aeff5..26adeab 100644 --- a/card10-l0dable/src/framebuffer/mod.rs +++ b/card10-l0dable/src/framebuffer/mod.rs @@ -81,14 +81,15 @@ impl<'d> Drawing for FrameBuffer<'d> { where T: IntoIterator>, { - for Pixel(coord, color) in item { + for Pixel(coord, Rgb565(color)) in item { let x = coord[0] as u16; let y = coord[1] as u16; if x >= Display::W || y >= Display::H { continue; } - self[(x, y)] = RawColor::rgb8(color.r(), color.g(), color.b()); + // Swap bytes + self[(x, y)] = RawColor([(color >> 8) as u8, color as u8]); } } } -- GitLab