diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-11-09 17:59:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-11-09 17:59:14 +0300 |
commit | db1e60556c72b1b87ff2a384c556ccca724c46d6 (patch) | |
tree | 22a5f4e9c4f436ef8e746e0a2d688de80c1597a6 /src/resources/imagehelper.cpp | |
parent | c2bb49be52a92deccec7428b6859242688fc8987 (diff) | |
parent | 1716861f0ee2f7a3714c5b44bb0f017c3d8d3b2c (diff) | |
download | plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.gz plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.bz2 plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.xz plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.zip |
Merge branch 'master' into stable
Diffstat (limited to 'src/resources/imagehelper.cpp')
-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; } |