- Reset the SDL texture to avoid the renderer hanging.

This commit is contained in:
Michael Kamensky
2020-08-22 18:02:37 +03:00
committed by David Hrdlička
parent 2d6cc7576b
commit 69c8af4a2e
2 changed files with 17 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ extern int sdl_inith_fs(HWND h);
extern int sdl_pause(void);
extern void sdl_resize(int x, int y);
extern void sdl_enable(int enable);
extern void sdl_reinit_texture();
#endif /*WIN_SDL_H*/

View File

@@ -181,6 +181,8 @@ sdl_stretch(int *w, int *h, int *x, int *y)
*y = (int) dy;
break;
}
sdl_reinit_texture();
}
@@ -489,6 +491,18 @@ sdl_inith_fs(HWND h)
}
void
sdl_reinit_texture()
{
if (sdl_render == NULL)
return;
SDL_DestroyTexture(sdl_tex);
sdl_tex = SDL_CreateTexture(sdl_render, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, 2048, 2048);
}
int
sdl_pause(void)
{
@@ -514,6 +528,8 @@ sdl_resize(int x, int y)
cur_w = x;
cur_h = y;
sdl_reinit_texture();
}