Bitmap: Feed image extension into SDL2_image for faster loading

This commit is contained in:
Jonas Kulla 2013-11-30 14:28:50 +01:00
parent 64f35071ab
commit a65956818f
1 changed files with 3 additions and 2 deletions

View File

@ -210,8 +210,9 @@ struct BitmapPrivate
Bitmap::Bitmap(const char *filename) Bitmap::Bitmap(const char *filename)
{ {
SDL_RWops ops; SDL_RWops ops;
shState->fileSystem().openRead(ops, filename, FileSystem::Image); const char *extension;
SDL_Surface *imgSurf = IMG_Load_RW(&ops, 1); shState->fileSystem().openRead(ops, filename, FileSystem::Image, false, &extension);
SDL_Surface *imgSurf = IMG_LoadTyped_RW(&ops, 1, extension);
if (!imgSurf) if (!imgSurf)
throw Exception(Exception::SDLError, "SDL: %s", SDL_GetError()); throw Exception(Exception::SDLError, "SDL: %s", SDL_GetError());