Browse code

Tightened screen debugger redraw

neauoire authored on 16/08/2023 21:33:45
Showing 1 changed files
... ...
@@ -85,6 +85,7 @@ draw_byte(Uint8 v, Uint16 x, Uint16 y, Uint8 color)
85 85
 {
86 86
 	screen_blit(uxn_screen.fg, icons, v >> 4 << 3, x, y, color, 0, 0, 0);
87 87
 	screen_blit(uxn_screen.fg, icons, (v & 0xf) << 3, x + 8, y, color, 0, 0, 0);
88
+	screen_change(x, y, x + 0x10, y + 0x8);
88 89
 }
89 90
 
90 91
 static void
... ...
@@ -147,26 +148,21 @@ screen_resize(Uint16 width, Uint16 height)
147 148
 void
148 149
 screen_redraw(Uxn *u)
149 150
 {
151
+	int i, j, o, y;
150 152
 	Uint8 *fg = uxn_screen.fg, *bg = uxn_screen.bg;
153
+	Uint16 w = uxn_screen.width, h = uxn_screen.height;
154
+	Uint16 x1 = uxn_screen.x1, y1 = uxn_screen.y1;
155
+	Uint16 x2 = uxn_screen.x2 > w ? w : uxn_screen.x2, y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
151 156
 	Uint32 palette[16], *pixels = uxn_screen.pixels;
152
-	int i, x, y, w = uxn_screen.width, h = uxn_screen.height, x1, y1, x2, y2;
153
-	if(u->dev[0x0e]) {
154
-		screen_change(0, 0, w, h);
157
+	uxn_screen.x1 = uxn_screen.y1 = 0xffff;
158
+	uxn_screen.x2 = uxn_screen.y2 = 0;
159
+	if(u->dev[0x0e])
155 160
 		screen_debugger(u);
156
-	}
157
-	x1 = uxn_screen.x1;
158
-	y1 = uxn_screen.y1;
159
-	x2 = uxn_screen.x2 > w ? w : uxn_screen.x2;
160
-	y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
161 161
 	for(i = 0; i < 16; i++)
162 162
 		palette[i] = uxn_screen.palette[(i >> 2) ? (i >> 2) : (i & 3)];
163 163
 	for(y = y1; y < y2; y++)
164
-		for(x = x1; x < x2; x++) {
165
-			i = x + y * w;
164
+		for(o = y * w, i = x1 + o, j = x2 + o; i < j; i++)
166 165
 			pixels[i] = palette[fg[i] << 2 | bg[i]];
167
-		}
168
-	uxn_screen.x1 = uxn_screen.y1 = 0xffff;
169
-	uxn_screen.x2 = uxn_screen.y2 = 0;
170 166
 }
171 167
 
172 168
 Uint8