diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-11-02 00:30:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-11-02 00:30:15 +0300 |
commit | 3f04f19a4e30eadf18e2aa18df01655de58a1ffa (patch) | |
tree | 367852ed3d5600565949a749e8b40e10ca1253c8 /src/resources | |
parent | 2d666d9a3b1bc0aeede357882e054b6afd17a9f1 (diff) | |
download | manaplus-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.tar.gz manaplus-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.tar.bz2 manaplus-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.tar.xz manaplus-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.zip |
fix images in did you know dialog.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/imagehelper.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp index dbbe21769..51ca0d44e 100644 --- a/src/resources/imagehelper.cpp +++ b/src/resources/imagehelper.cpp @@ -120,13 +120,21 @@ SDL_Surface *ImageHelper::loadPng(SDL_RWops *const rw) if (!rw) return nullptr; - if (!IMG_isPNG(rw)) + if (IMG_isPNG(rw)) { - logger->log("Error, image is not png"); + SDL_Surface *const tmpImage = MIMG_LoadPNG_RW(rw); SDL_RWclose(rw); - return nullptr; + return tmpImage; + } + + if (IMG_isJPG(rw)) + { + SDL_Surface *const tmpImage = MIMG_LoadJPG_RW(rw); + SDL_RWclose(rw); + return tmpImage; } - SDL_Surface *const tmpImage = MIMG_LoadPNG_RW(rw); + + logger->log("Error, image is not png"); SDL_RWclose(rw); - return tmpImage; + return nullptr; } |