Mercurial > repos > blastem
comparison render_sdl.c @ 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 | 55198fc9cc1f |
children | b387f1c5a1d0 |
comparison
equal
deleted
inserted
replaced
1894:55d034719345 | 1895:33c0c4579c1f |
---|---|
385 static void render_alloc_surfaces() | 385 static void render_alloc_surfaces() |
386 { | 386 { |
387 if (texture_init) { | 387 if (texture_init) { |
388 return; | 388 return; |
389 } | 389 } |
390 sdl_textures= malloc(sizeof(SDL_Texture *) * 2); | 390 sdl_textures= calloc(sizeof(SDL_Texture *), 3); |
391 num_textures = 2; | 391 num_textures = 3; |
392 texture_init = 1; | 392 texture_init = 1; |
393 #ifndef DISABLE_OPENGL | 393 #ifndef DISABLE_OPENGL |
394 if (render_gl) { | 394 if (render_gl) { |
395 sdl_textures[0] = sdl_textures[1] = NULL; | |
396 gl_setup(); | 395 gl_setup(); |
397 } else { | 396 } else { |
398 #endif | 397 #endif |
399 tern_val def = {.ptrval = "linear"}; | 398 tern_val def = {.ptrval = "linear"}; |
400 char *scaling = tern_find_path_default(config, "video\0scaling\0", def, TVAL_PTR).ptrval; | 399 char *scaling = tern_find_path_default(config, "video\0scaling\0", def, TVAL_PTR).ptrval; |
1296 if (render_gl && which <= FRAMEBUFFER_EVEN) { | 1295 if (render_gl && which <= FRAMEBUFFER_EVEN) { |
1297 *pitch = LINEBUF_SIZE * sizeof(uint32_t); | 1296 *pitch = LINEBUF_SIZE * sizeof(uint32_t); |
1298 return texture_buf; | 1297 return texture_buf; |
1299 } else { | 1298 } else { |
1300 #endif | 1299 #endif |
1301 if (which == FRAMEBUFFER_UI && which >= num_textures) { | |
1302 sdl_textures = realloc(sdl_textures, sizeof(*sdl_textures) * (FRAMEBUFFER_UI + 1)); | |
1303 for (; num_textures <= FRAMEBUFFER_UI; num_textures++) | |
1304 { | |
1305 sdl_textures[num_textures] = NULL; | |
1306 } | |
1307 } | |
1308 if (which == FRAMEBUFFER_UI && !sdl_textures[which]) { | 1300 if (which == FRAMEBUFFER_UI && !sdl_textures[which]) { |
1309 sdl_textures[which] = SDL_CreateTexture(main_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, main_width, main_height); | 1301 sdl_textures[which] = SDL_CreateTexture(main_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, main_width, main_height); |
1310 } | 1302 } |
1311 if (which >= num_textures) { | 1303 if (which >= num_textures) { |
1312 warning("Request for invalid framebuffer number %d\n", which); | 1304 warning("Request for invalid framebuffer number %d\n", which); |