-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -499,6 +499,9 @@ impl Screen { | |
} | ||
|
||
pub fn putpixel_direct(&mut self, x: i32, y: i32, col: u32) { | ||
if x >= px8::SCREEN_WIDTH as i32 || y >= px8::SCREEN_HEIGHT as i32 { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
return; | ||
} | ||
self.back_buffer[Screen::pixel_offset(x, y)] = col as u8; | ||
} | ||
|
||
|
@@ -513,6 +516,10 @@ impl Screen { | |
return; | ||
}; | ||
|
||
if x >= px8::SCREEN_WIDTH as i32 || y >= px8::SCREEN_HEIGHT as i32 { | ||
This comment has been minimized.
Sorry, something went wrong.
johnbatty
Contributor
|
||
return; | ||
} | ||
|
||
let draw_col = self.color_map[(col & 0xFF) as usize]; | ||
|
||
self.back_buffer[Screen::pixel_offset(x, y)] = draw_col; | ||
|
Yep, we need this check. In fact as the coords are i32 they should also be checked for negative values.