From 3f04f19a4e30eadf18e2aa18df01655de58a1ffa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 2 Nov 2013 00:30:15 +0300 Subject: fix images in did you know dialog. --- src/resources/imagehelper.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/resources') 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; } -- cgit v1.2.3-70-g09d2