mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-18 18:40:14 +01:00
fix crash on window resize
This commit is contained in:
parent
5f4d2fba25
commit
6784657af5
|
@ -67,13 +67,13 @@ impl ApplicationHandler for App<'_> {
|
||||||
|
|
||||||
let window = self.window.as_ref().unwrap();
|
let window = self.window.as_ref().unwrap();
|
||||||
let pixels = self.pixels.as_mut().unwrap();
|
let pixels = self.pixels.as_mut().unwrap();
|
||||||
|
|
||||||
let mut frame = pixels.frame_mut().chunks_exact_mut(4);
|
let mut frame = pixels.frame_mut().chunks_exact_mut(4);
|
||||||
|
|
||||||
let display = self.display.read().unwrap();
|
let display = self.display.read().unwrap();
|
||||||
|
|
||||||
let size = window.inner_size();
|
for y in 0..PIXEL_HEIGHT {
|
||||||
for y in 0..size.height {
|
for x in 0..PIXEL_WIDTH {
|
||||||
for x in 0..size.width {
|
|
||||||
let is_set = display.get(x as usize, y as usize);
|
let is_set = display.get(x as usize, y as usize);
|
||||||
let color = if is_set {
|
let color = if is_set {
|
||||||
[255u8, 255, 255, 255]
|
[255u8, 255, 255, 255]
|
||||||
|
|
Loading…
Reference in a new issue