[WIP] Fix out of bounds screen drawing
This commit is contained in:
parent
bff3fc6dc6
commit
a85aa571d9
11
src/ppu.c
11
src/ppu.c
|
@ -64,11 +64,12 @@ rgb565(u32 rgba) {
|
||||||
|
|
||||||
void
|
void
|
||||||
ppu_pixel(u8 *layer, u16 x, u16 y, u8 color) {
|
ppu_pixel(u8 *layer, u16 x, u16 y, u8 color) {
|
||||||
if(x < screen_width && y < screen_height) {
|
if (x >= screen_width || y >= screen_height) {
|
||||||
Uint32 i = x + y *screen_width;
|
return;
|
||||||
if(color != layer[i]) {
|
}
|
||||||
layer[i] = color;
|
Uint32 i = x + y *screen_width;
|
||||||
}
|
if(color != layer[i]) {
|
||||||
|
layer[i] = color;
|
||||||
}
|
}
|
||||||
dirty_lines[y] |= 1;
|
dirty_lines[y] |= 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue