Skip to content
Snippets Groups Projects
Commit 5fe94ce4 authored by deuce's avatar deuce
Browse files

Always destroy the texture before creating a new one.

Derp.
parent 83903f47
No related branches found
No related tags found
No related merge requests found
......@@ -552,6 +552,8 @@ static void setup_surfaces_locked(void)
if (win == NULL) {
// SDL2: This is slow sometimes... not sure why.
if (sdl.CreateWindowAndRenderer(cvstat.winwidth, cvstat.winheight, flags, &win, &renderer) == 0) {
if (texture)
sdl.DestroyTexture(texture);
sdl.RenderClear(renderer);
texture = sdl.CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, charwidth*cols, charheight*rows);
}
......@@ -562,6 +564,8 @@ static void setup_surfaces_locked(void)
}
else {
sdl.SetWindowSize(win, cvstat.winwidth, cvstat.winheight);
if (texture)
sdl.DestroyTexture(texture);
texture = sdl.CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, charwidth*cols, charheight*rows);
}
sdl.SetWindowMinimumSize(win, cvstat.charwidth * cvstat.cols, cvstat.charheight * cvstat.rows);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment