Fixed out of bounds error

This commit is contained in:
STP
2023-11-17 21:21:34 -05:00
parent 0c1313a913
commit 93621f36ed
2 changed files with 2 additions and 2 deletions

View File

@@ -7,7 +7,7 @@ const BUFFER_PROPORTION_MAX: f32 = 0.9;
const RAYS_INIT: i32 = 100; const RAYS_INIT: i32 = 100;
const RAYS_MIN: i32 = 100; const RAYS_MIN: i32 = 100;
const RAYS_MAX: i32 = 1000; const RAYS_MAX: i32 = 10000;
/// Manages all state required for rendering Dear ImGui over `Pixels`. /// Manages all state required for rendering Dear ImGui over `Pixels`.
pub(crate) struct Gui { pub(crate) struct Gui {

View File

@@ -163,7 +163,7 @@ impl State {
let mut pixels = self.pixels.lock().unwrap(); let mut pixels = self.pixels.lock().unwrap();
let frame = pixels.frame_mut(); let frame = pixels.frame_mut();
frame[i * 4..(i + 1) * 4].copy_from_slice(&rgba); frame[i * 4..(i + 1) * 4].copy_from_slice(&rgba);
self.index = self.index + 1; self.index = (self.index + 1) % (frame.len() / 4);
} }
} }