commit d09f352

Devine Lu Linvega  ·  2025-01-21 17:34:49 +0000 UTC
parent 145fd92
Removed unnecessary check for pixels in screen
1 files changed,  +4, -8
+4, -8
 1@@ -69,20 +69,16 @@ screen_resize(Uint16 width, Uint16 height, int scale)
 2 	clamp(width, 8, 0x800);
 3 	clamp(height, 8, 0x800);
 4 	clamp(scale, 1, 3);
 5-	/* Pixels */
 6+	/* on rescale */
 7 	pixels = realloc(uxn_screen.pixels, width * height * sizeof(Uint32) * scale * scale);
 8 	if(!pixels) return;
 9 	uxn_screen.pixels = pixels;
10 	uxn_screen.scale = scale;
11-	/* layers */
12+	/* on resize */
13 	if(uxn_screen.width != width || uxn_screen.height != height) {
14 		int i, length = MAR2(width) * MAR2(height);
15-		Uint8 *bg = malloc(length), *fg = malloc(length);
16-		if(!bg || !fg || !pixels) {
17-			free(bg), free(fg);
18-			return;
19-		}
20-		free(uxn_screen.bg), free(uxn_screen.fg);
21+		Uint8 *bg = realloc(uxn_screen.bg, length), *fg = realloc(uxn_screen.fg, length);
22+		if(!bg || !fg) return;
23 		uxn_screen.bg = bg, uxn_screen.fg = fg;
24 		uxn_screen.width = width, uxn_screen.height = height;
25 		for(i = 0; i < length; i++)