summaryrefslogtreecommitdiff
path: root/src/resources/imagehelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-02 00:30:15 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-02 00:30:15 +0300
commit3f04f19a4e30eadf18e2aa18df01655de58a1ffa (patch)
tree367852ed3d5600565949a749e8b40e10ca1253c8 /src/resources/imagehelper.cpp
parent2d666d9a3b1bc0aeede357882e054b6afd17a9f1 (diff)
downloadmv-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.tar.gz
mv-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.tar.bz2
mv-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.tar.xz
mv-3f04f19a4e30eadf18e2aa18df01655de58a1ffa.zip
fix images in did you know dialog.
Diffstat (limited to 'src/resources/imagehelper.cpp')
-rw-r--r--src/resources/imagehelper.cpp18
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;
}