added re-initialization of textures after change of renderer
[rocksndiamonds.git] / src / libgame / sdl.c
index 0b2e1c1663064c7886a5cfe46e36f52db794deee..0759b549fe643dc5ace17a427b8b38f77b6dbd0c 100644 (file)
@@ -317,6 +317,11 @@ void SDLCreateBitmapTextures(Bitmap *bitmap)
   if (bitmap == NULL)
     return;
 
+  if (bitmap->texture)
+    SDL_DestroyTexture(bitmap->texture);
+  if (bitmap->texture_masked)
+    SDL_DestroyTexture(bitmap->texture_masked);
+
   bitmap->texture        = SDLCreateTextureFromSurface(bitmap->surface);
   bitmap->texture_masked = SDLCreateTextureFromSurface(bitmap->surface_masked);
 #endif