commit 530ff4bef2728843517636626decb165e4ea5ef7
parent 69f770f56fa671067a171fe40b2ce71b44b9c26d
Author: neauoire <aliceffekt@gmail.com>
Date: Thu, 8 Apr 2021 10:06:17 -0700
Removed old rect data from the PPU
Diffstat:
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/ppu.c b/src/ppu.c
@@ -46,7 +46,7 @@ clear(Ppu *p)
void
drawpixel(Ppu *p, Uint16 x, Uint16 y, Uint8 color)
{
- if(x >= p->x1 && x <= p->x2 && y >= p->x1 && y <= p->y2)
+ if(x >= p->pad && x <= p->width - p->pad - 1 && y >= p->pad && y <= p->height - p->pad - 1)
p->output[y * p->width + x] = p->colors[color];
}
@@ -79,7 +79,7 @@ drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
{
Uint8 i, x, y, b;
for(i = 0; i < 0x10; ++i) { /* memory */
- x = ((i % 8) * 3 + 3) * 8, y = p->x1 + 8 + i / 8 * 8, b = stack[i];
+ x = ((i % 8) * 3 + 3) * 8, y = p->pad + 8 + i / 8 * 8, b = stack[i];
drawicn(p, x, y, font[(b >> 4) & 0xf], 1 + (ptr == i), 0);
drawicn(p, x + 8, y, font[b & 0xf], 1 + (ptr == i), 0);
}
@@ -151,9 +151,5 @@ initppu(Ppu *p, Uint8 hor, Uint8 ver, Uint8 pad)
if(!(p->fg = malloc(p->width * p->height * sizeof(Uint8) * 2)))
return 0;
clear(p);
- p->x1 = p->pad;
- p->x2 = p->width - p->pad - 1;
- p->y1 = p->pad;
- p->y2 = p->height - p->pad - 1;
return 1;
}
\ No newline at end of file
diff --git a/src/ppu.h b/src/ppu.h
@@ -20,7 +20,7 @@ typedef unsigned int Uint32;
typedef struct Ppu {
Uint8 reqdraw, zoom, debugger, *bg, *fg;
- Uint16 hor, ver, pad, width, height, x1, y1, x2, y2;
+ Uint16 hor, ver, pad, width, height;
Uint32 *output, colors[4];
} Ppu;