Browse code

Removed old rect data from the PPU

neauoire authored on 08/04/2021 17:06:17
Showing 2 changed files
... ...
@@ -46,7 +46,7 @@ clear(Ppu *p)
46 46
 void
47 47
 drawpixel(Ppu *p, Uint16 x, Uint16 y, Uint8 color)
48 48
 {
49
-	if(x >= p->x1 && x <= p->x2 && y >= p->x1 && y <= p->y2)
49
+	if(x >= p->pad && x <= p->width - p->pad - 1 && y >= p->pad && y <= p->height - p->pad - 1)
50 50
 		p->output[y * p->width + x] = p->colors[color];
51 51
 }
52 52
 
... ...
@@ -79,7 +79,7 @@ drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
79 79
 {
80 80
 	Uint8 i, x, y, b;
81 81
 	for(i = 0; i < 0x10; ++i) { /* memory */
82
-		x = ((i % 8) * 3 + 3) * 8, y = p->x1 + 8 + i / 8 * 8, b = stack[i];
82
+		x = ((i % 8) * 3 + 3) * 8, y = p->pad + 8 + i / 8 * 8, b = stack[i];
83 83
 		drawicn(p, x, y, font[(b >> 4) & 0xf], 1 + (ptr == i), 0);
84 84
 		drawicn(p, x + 8, y, font[b & 0xf], 1 + (ptr == i), 0);
85 85
 	}
... ...
@@ -151,9 +151,5 @@ initppu(Ppu *p, Uint8 hor, Uint8 ver, Uint8 pad)
151 151
 	if(!(p->fg = malloc(p->width * p->height * sizeof(Uint8) * 2)))
152 152
 		return 0;
153 153
 	clear(p);
154
-	p->x1 = p->pad;
155
-	p->x2 = p->width - p->pad - 1;
156
-	p->y1 = p->pad;
157
-	p->y2 = p->height - p->pad - 1;
158 154
 	return 1;
159 155
 }
160 156
\ No newline at end of file
... ...
@@ -20,7 +20,7 @@ typedef unsigned int Uint32;
20 20
 
21 21
 typedef struct Ppu {
22 22
 	Uint8 reqdraw, zoom, debugger, *bg, *fg;
23
-	Uint16 hor, ver, pad, width, height, x1, y1, x2, y2;
23
+	Uint16 hor, ver, pad, width, height;
24 24
 	Uint32 *output, colors[4];
25 25
 } Ppu;
26 26