From 692708c0d4c35bb0bafa38e2869f2876494b2364 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 9 Dec 2024 19:32:56 +0100 Subject: [PATCH] added function to free all textures --- src/init.c | 5 +++++ src/init.h | 1 + src/tools.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/init.c b/src/init.c index 1355af88..04d55b8b 100644 --- a/src/init.c +++ b/src/init.c @@ -449,6 +449,11 @@ void InitImageTextures(void) CreateImageTextures(texture_graphics[i]); } +void FreeAllTextures(void) +{ + FreeAllImageTextures(); +} + static int getFontSpecialSuffix(void) { int special = -1; diff --git a/src/init.h b/src/init.h index 9479f0f8..517bf7d3 100644 --- a/src/init.h +++ b/src/init.h @@ -39,6 +39,7 @@ void KeyboardAutoRepeatOffUnlessAutoplay(void); void InitGfxBuffers(void); void InitGadgets(void); void InitImageTextures(void); +void FreeAllTextures(void); boolean anyImagehasColorTemplate(void); void InitColorTemplateImages(void); diff --git a/src/tools.c b/src/tools.c index a20fc51a..1fdc53e9 100644 --- a/src/tools.c +++ b/src/tools.c @@ -11951,7 +11951,7 @@ void ChangeVsyncModeIfNeeded(void) video.fullscreen_enabled = !setup.fullscreen; // when creating new renderer, destroy textures linked to old renderer - FreeAllImageTextures(); // needs old renderer to free the textures + FreeAllTextures(); // needs old renderer to free the textures // re-create screen and renderer (including change of vsync mode) ChangeVideoModeIfNeeded(setup.fullscreen); @@ -12304,7 +12304,7 @@ void ChangeViewportPropertiesIfNeeded(void) { // Debug("tools:viewport", "init_video_buffer"); - FreeAllImageTextures(); // needs old renderer to free the textures + FreeAllTextures(); // needs old renderer to free the textures InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen); InitImageTextures(); -- 2.34.1