fixed re-initialization of textures after change of renderer
[rocksndiamonds.git] / src / libgame / sdl.c
index 7fbd38f7de3f072a809ee218f06ea9da7093d153..d431aacf29c96c34d73b2a4db489d075608a5640 100644 (file)
@@ -349,6 +349,22 @@ void SDLCreateBitmapTextures(Bitmap *bitmap)
 #endif
 }
 
+void SDLFreeBitmapTextures(Bitmap *bitmap)
+{
+#if defined(TARGET_SDL2)
+  if (bitmap == NULL)
+    return;
+
+  if (bitmap->texture)
+    SDL_DestroyTexture(bitmap->texture);
+  if (bitmap->texture_masked)
+    SDL_DestroyTexture(bitmap->texture_masked);
+
+  bitmap->texture = NULL;
+  bitmap->texture_masked = NULL;
+#endif
+}
+
 void SDLInitVideoDisplay(void)
 {
 #if !defined(TARGET_SDL2)