{
int i, j, k;
+ FreeAllImageTextures();
+
for (i = 0; i < NUM_GLOBAL_ANIMS; i++)
{
for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
if (graphic == IMG_UNDEFINED)
continue;
- // (re)create textures from images for fast GPU blitting, if possible
- ReCreateImageTextures(graphic);
+ CreateImageTextures(graphic);
}
}
}
setString(&img_info->leveldir, leveldir_current->identifier);
}
-static void CreateImageTexturesExt(int pos, boolean force)
+void CreateImageTextures(int pos)
{
ImageInfo *img_info = getImageInfoEntryFromImageID(pos);
- if (img_info == NULL || (img_info->contains_textures && !force))
+ if (img_info == NULL || img_info->contains_textures)
return;
CreateBitmapTextures(img_info->bitmaps);
img_info->contains_textures = TRUE;
}
-void CreateImageTextures(int pos)
+void FreeImageTextures(int pos)
{
- CreateImageTexturesExt(pos, FALSE);
+ ImageInfo *img_info = getImageInfoEntryFromImageID(pos);
+
+ if (img_info == NULL || !img_info->contains_textures)
+ return;
+
+ FreeBitmapTextures(img_info->bitmaps);
+
+ img_info->contains_textures = FALSE;
}
-void ReCreateImageTextures(int pos)
+void FreeAllImageTextures()
{
- CreateImageTexturesExt(pos, TRUE);
+ int num_images = getImageListSize();
+ int i;
+
+ for (i = 0; i < num_images; i++)
+ FreeImageTextures(i);
}
void ScaleImage(int pos, int zoom_factor)
void ReloadCustomImages();
void CreateImageWithSmallImages(int, int, int);
void CreateImageTextures(int);
-void ReCreateImageTextures(int);
+void FreeAllImageTextures();
void ScaleImage(int, int);
void FreeAllImages();
#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)
boolean SDLSetNativeSurface(SDL_Surface **);
SDL_Surface *SDLGetNativeSurface(SDL_Surface *);
void SDLCreateBitmapTextures(Bitmap *);
+void SDLFreeBitmapTextures(Bitmap *);
#if defined(TARGET_SDL2)
SDL_Surface *SDL_DisplayFormat(SDL_Surface *);
SDLCreateBitmapTextures(bitmaps[IMG_BITMAP_STANDARD]);
}
+void FreeBitmapTextures(Bitmap **bitmaps)
+{
+ SDLFreeBitmapTextures(bitmaps[IMG_BITMAP_STANDARD]);
+}
+
void ScaleBitmap(Bitmap **bitmaps, int zoom_factor)
{
CreateScaledBitmaps(bitmaps, zoom_factor, 0, FALSE);
void ReCreateGameTileSizeBitmap(Bitmap **);
void CreateBitmapWithSmallBitmaps(Bitmap **, int, int);
void CreateBitmapTextures(Bitmap **);
+void FreeBitmapTextures(Bitmap **);
void ScaleBitmap(Bitmap **, int);
void SetMouseCursor(int);