changeset 1895:33c0c4579c1f

Fix debug view window stuff that got broken when FRAMEBUFFER_UI got added
author Michael Pavone <pavone@retrodev.com>
date Mon, 06 Jan 2020 22:02:57 -0800
parents 55d034719345
children c157a535ceeb
files render_sdl.c
diffstat 1 files changed, 2 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/render_sdl.c	Mon Jan 06 18:36:36 2020 -0800
+++ b/render_sdl.c	Mon Jan 06 22:02:57 2020 -0800
@@ -387,12 +387,11 @@
 	if (texture_init) {
 		return;
 	}
-	sdl_textures= malloc(sizeof(SDL_Texture *) * 2);
-	num_textures = 2;
+	sdl_textures= calloc(sizeof(SDL_Texture *), 3);
+	num_textures = 3;
 	texture_init = 1;
 #ifndef DISABLE_OPENGL
 	if (render_gl) {
-		sdl_textures[0] = sdl_textures[1] = NULL;
 		gl_setup();
 	} else {
 #endif
@@ -1298,13 +1297,6 @@
 		return texture_buf;
 	} else {
 #endif
-		if (which == FRAMEBUFFER_UI && which >= num_textures) {
-			sdl_textures = realloc(sdl_textures, sizeof(*sdl_textures) * (FRAMEBUFFER_UI + 1));
-			for (; num_textures <= FRAMEBUFFER_UI; num_textures++)
-			{
-				sdl_textures[num_textures] = NULL;
-			}
-		}
 		if (which == FRAMEBUFFER_UI && !sdl_textures[which]) {
 			sdl_textures[which] = SDL_CreateTexture(main_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, main_width, main_height);
 		}