commit b264bee

Devie Lu Linvega  ·  2025-12-23 18:15:12 +0000 UTC
parent 4042ce0
Cleanup
1 files changed,  +15, -16
+15, -16
  1@@ -409,9 +409,8 @@ console_input(int c, unsigned int type)
  2 #define MAR(x) (x + 0x8)
  3 #define MAR2(x) (x + 0x10)
  4 
  5-static int screen_width, screen_height;
  6-static int screen_resized, screen_full, screen_zoom;
  7-static int screen_x1, screen_y1, screen_x2, screen_y2;
  8+static int screen_width, screen_height, screen_zoom;
  9+static int screen_x1, screen_y1, screen_x2, screen_y2, screen_reqsize, screen_reqdraw;
 10 static unsigned int screen_vector, *screen_pixels, screen_palette[16];
 11 static Uint8 *screen_layers;
 12 
 13@@ -457,7 +456,7 @@ screen_colorize(void)
 14 	}
 15 	for(i = 0; i < 16; i++)
 16 		screen_palette[i] = colors[(i >> 2) ? (i >> 2) : (i & 3)];
 17-	screen_full = 1;
 18+	screen_reqdraw = 1;
 19 }
 20 
 21 static void
 22@@ -469,8 +468,8 @@ screen_resize(int width, int height)
 23 		memset(screen_layers, 0, length);
 24 		screen_width = width;
 25 		screen_height = height;
 26-		screen_resized = 1;
 27-		screen_full = 1;
 28+		screen_reqsize = 1;
 29+		screen_reqdraw = 1;
 30 	}
 31 }
 32 
 33@@ -494,7 +493,7 @@ scree_redraw(void)
 34 		}
 35 	}
 36 	XPutImage(display, window, DefaultGC(display, 0), ximage, ax, ay, ax, ay, aw, ah);
 37-	screen_x1 = screen_y1 = screen_x2 = screen_y2 = screen_full = 0;
 38+	screen_x1 = screen_y1 = screen_x2 = screen_y2 = screen_reqdraw = 0;
 39 }
 40 
 41 static void
 42@@ -502,7 +501,7 @@ screen_update(void)
 43 {
 44 	if(screen_vector)
 45 		uxn_eval(screen_vector);
 46-	if(screen_resized) {
 47+	if(screen_reqsize) {
 48 		const int width = screen_width * screen_zoom;
 49 		const int height = screen_height * screen_zoom;
 50 		const int length = screen_width * screen_height * sizeof(unsigned int) * screen_zoom * screen_zoom;
 51@@ -511,10 +510,10 @@ screen_update(void)
 52 		if(ximage)
 53 			free(ximage);
 54 		ximage = XCreateImage(display, DefaultVisual(display, 0), DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)screen_pixels, width, height, 32, 0);
 55-		screen_full = 1;
 56-		screen_resized = 0;
 57+		screen_reqdraw = 1;
 58+		screen_reqsize = 0;
 59 	}
 60-	if(screen_full) {
 61+	if(screen_reqdraw) {
 62 		screen_x1 = screen_y1 = 0;
 63 		screen_x2 = screen_width;
 64 		screen_y2 = screen_height;
 65@@ -550,7 +549,7 @@ screen_draw_pixel(void)
 66 			y1 = 0, y2 = rY;
 67 		else
 68 			y1 = rY, y2 = screen_height;
 69-		screen_full = 1;
 70+		screen_reqdraw = 1;
 71 		x1 = MAR(x1), y1 = MAR(y1);
 72 		hor = MAR(x2) - x1, ver = MAR(y2) - y1;
 73 		for(ay = y1 * len, by = ay + ver * len; ay < by; ay += len)
 74@@ -566,7 +565,7 @@ screen_draw_pixel(void)
 75 			const int src = screen_layers[ax];
 76 			screen_layers[ax] = above ? (src & 0x3) | color : (src & 0xc) | color;
 77 		}
 78-		if(!screen_full) screen_change(rX, rY, rX + 1, rY + 1);
 79+		if(!screen_reqdraw) screen_change(rX, rY, rX + 1, rY + 1);
 80 		if(rMX) rX++;
 81 		if(rMY) rY++;
 82 	}
 83@@ -635,7 +634,7 @@ screen_draw_sprite(void)
 84 		y1 = y, y2 = rY;
 85 	else
 86 		y1 = rY, y2 = y;
 87-	if(!screen_full) screen_change(x1 - 8, y1 - 8, x2 + 8, y2 + 8);
 88+	if(!screen_reqdraw) screen_change(x1 - 8, y1 - 8, x2 + 8, y2 + 8);
 89 	if(rMX) rX += rDX * fx;
 90 	if(rMY) rY += rDY * fy;
 91 }
 92@@ -1144,7 +1143,7 @@ emu_event(void)
 93 	XNextEvent(display, &ev);
 94 	switch(ev.type) {
 95 	case Expose:
 96-		screen_full = 1;
 97+		screen_reqdraw = 1;
 98 		break;
 99 	case ClientMessage:
100 		dev[0x0f] = 0x80;
101@@ -1153,7 +1152,7 @@ emu_event(void)
102 		KeySym sym;
103 		XLookupString((XKeyPressedEvent *)&ev, buf, 7, &sym, 0);
104 		switch(sym) {
105-		case XK_F1: screen_zoom = (screen_zoom % 3) + 1, screen_resized = 1; break;
106+		case XK_F1: screen_zoom = (screen_zoom % 3) + 1, screen_reqsize = 1; break;
107 		case XK_F2: emu_deo(0xe, 0x1); break;
108 		case XK_F4: emu_restart(0); break;
109 		case XK_F5: emu_restart(1); break;