commit 9f409c9
Devine Lu Linvega
·
2024-12-15 18:06:45 +0000 UTC
parent 5f6c9a8
(screen) Minor improvements
1 files changed,
+9,
-10
+9,
-10
1@@ -119,23 +119,22 @@ screen_resize(Uint16 width, Uint16 height, int scale)
2 void
3 screen_redraw(void)
4 {
5- int i, x, y, k, l, s = uxn_screen.scale;
6- Uint8 *fg = uxn_screen.fg, *bg = uxn_screen.bg;
7- Uint16 w = uxn_screen.width, h = uxn_screen.height;
8+ int i, x, y, k, l;
9 Uint16 x1 = uxn_screen.x1, y1 = uxn_screen.y1;
10- Uint16 x2 = uxn_screen.x2 > w ? w : uxn_screen.x2, y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
11+ Uint16 x2 = uxn_screen.x2 > uxn_screen.width ? uxn_screen.width : uxn_screen.x2;
12+ Uint16 y2 = uxn_screen.y2 > uxn_screen.height ? uxn_screen.height : uxn_screen.y2;
13 Uint32 palette[16], *pixels = uxn_screen.pixels;
14 uxn_screen.x1 = uxn_screen.y1 = 9000;
15 uxn_screen.x2 = uxn_screen.y2 = 0;
16 for(i = 0; i < 16; i++)
17 palette[i] = uxn_screen.palette[(i >> 2) ? (i >> 2) : (i & 3)];
18 for(y = y1; y < y2; y++) {
19- int ys = y * s;
20- for(x = x1, i = MAR(x) + MAR(y) * MAR2(w); x < x2; x++, i++) {
21- int c = palette[fg[i] << 2 | bg[i]];
22- for(k = 0; k < s; k++) {
23- int oo = ((ys + k) * w + x) * s;
24- for(l = 0; l < s; l++)
25+ int ys = y * uxn_screen.scale;
26+ for(x = x1, i = MAR(x) + MAR(y) * MAR2(uxn_screen.width); x < x2; x++, i++) {
27+ int c = palette[uxn_screen.fg[i] << 2 | uxn_screen.bg[i]];
28+ for(k = 0; k < uxn_screen.scale; k++) {
29+ int oo = ((ys + k) * uxn_screen.width + x) * uxn_screen.scale;
30+ for(l = 0; l < uxn_screen.scale; l++)
31 pixels[oo + l] = c;
32 }
33 }