Browse code

(screen.c) Merge all checks

Devine Lu Linvega authored on 13/04/2023 03:00:17
Showing 2 changed files
... ...
@@ -86,15 +86,15 @@ screen_resize(UxnScreen *p, Uint16 width, Uint16 height)
86 86
 	bg = realloc(p->bg.pixels, width * height),
87 87
 	fg = realloc(p->fg.pixels, width * height);
88 88
 	pixels = realloc(p->pixels, width * height * sizeof(Uint32));
89
-	if(bg) p->bg.pixels = bg;
90
-	if(fg) p->fg.pixels = fg;
91
-	if(pixels) p->pixels = pixels;
92
-	if(bg && fg && pixels) {
93
-		p->width = width;
94
-		p->height = height;
95
-		screen_fill(p, &p->bg, 0, 0, p->width, p->height, 0);
96
-		screen_fill(p, &p->fg, 0, 0, p->width, p->height, 0);
97
-	}
89
+	if(!bg || !fg || !pixels)
90
+		return;
91
+	p->bg.pixels = bg;
92
+	p->fg.pixels = fg;
93
+	p->pixels = pixels;
94
+	p->width = width;
95
+	p->height = height;
96
+	screen_fill(p, &p->bg, 0, 0, p->width, p->height, 0);
97
+	screen_fill(p, &p->fg, 0, 0, p->width, p->height, 0);
98 98
 }
99 99
 
100 100
 void
... ...
@@ -399,9 +399,8 @@ handle_events(Uxn *u)
399 399
 			SDL_free(event.drop.file);
400 400
 		}
401 401
 		/* Audio */
402
-		else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) {
402
+		else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY)
403 403
 			uxn_eval(u, PEEK2(&u->dev[0x30 + 0x10 * (event.type - audio0_event)]));
404
-		}
405 404
 		/* Mouse */
406 405
 		else if(event.type == SDL_MOUSEMOTION)
407 406
 			mouse_pos(u, &u->dev[0x90], clamp(event.motion.x - PAD, 0, uxn_screen.width - 1), clamp(event.motion.y - PAD, 0, uxn_screen.height - 1));