From d3278fccf4ce00105a09d67a8b32bf681cfa9bc4 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 21 Feb 2025 23:42:17 +0800 Subject: [PATCH] add missing trait implementations these aren't currently used, and probably won't be used in the future? so just some stand-in code is used that isn't too carefully thought-out. --- services/cramium-emu/src/display.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/services/cramium-emu/src/display.rs b/services/cramium-emu/src/display.rs index 088c070c3..f53d42b74 100644 --- a/services/cramium-emu/src/display.rs +++ b/services/cramium-emu/src/display.rs @@ -179,6 +179,24 @@ impl FrameBuffer for Oled128x128 { let color = ColorNative(buffer[(p.x + p.y * ROW) as usize] as usize); Some(color) } + + fn xor_pixel(&mut self, p: Point) { + if p.x > COLUMN || p.y > ROW || p.x < 0 || p.y < 0 { + return; + } + let buffer = self.buffer_mut(); + let color: Mono = ColorNative(buffer[(p.x + p.y * ROW) as usize] as usize).into(); + let xor_color = if color == Mono::Black { Mono::White } else { Mono::Black }; + let on: ColorNative = xor_color.into(); + buffer[(p.x + (ROW - 1 - p.y) * COLUMN) as usize] = on.0 as u32; + } + + /// This is highly unsafe. Don't use it - this is only implemented to provide cross-compatibility + /// with other platforms that require this access. + unsafe fn raw_mut(&mut self) -> &mut ux_api::platform::FbRaw { + let len = self.native_buffer.lock().unwrap().len(); + core::slice::from_raw_parts_mut(self.native_buffer.lock().unwrap().as_mut_ptr(), len) + } } impl MinifbThread {