From 6784657af5ac79b8948f91b1048e694bc578e1ab Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sat, 11 May 2024 01:05:58 +0200 Subject: [PATCH] fix crash on window resize --- src/gui.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui.rs b/src/gui.rs index 149438a..511d450 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -67,13 +67,13 @@ impl ApplicationHandler for App<'_> { let window = self.window.as_ref().unwrap(); let pixels = self.pixels.as_mut().unwrap(); + let mut frame = pixels.frame_mut().chunks_exact_mut(4); let display = self.display.read().unwrap(); - let size = window.inner_size(); - for y in 0..size.height { - for x in 0..size.width { + for y in 0..PIXEL_HEIGHT { + for x in 0..PIXEL_WIDTH { let is_set = display.get(x as usize, y as usize); let color = if is_set { [255u8, 255, 255, 255]