summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-10 00:49:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-10 03:07:44 +0300
commit45f076bd429c40d81607f43837f1cc571f3f6be0 (patch)
treed6559bb6fb9e87a4953a342cc4af0db8045ba1f4 /src/resources/resourcemanager.cpp
parentf75a1e7af1db4be56430765e19a5aee75284dd3e (diff)
downloadManaVerse-45f076bd429c40d81607f43837f1cc571f3f6be0.tar.gz
ManaVerse-45f076bd429c40d81607f43837f1cc571f3f6be0.tar.bz2
ManaVerse-45f076bd429c40d81607f43837f1cc571f3f6be0.tar.xz
ManaVerse-45f076bd429c40d81607f43837f1cc571f3f6be0.zip
Improve a bit image load speed.
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 542a96a9e..bd739644c 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -1012,7 +1012,15 @@ SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename) const
{
SDL_Surface *surface = nullptr;
if (SDL_RWops *const rw = PHYSFSRWOPS_openRead(filename.c_str()))
- surface = IMG_Load_RW(rw, 1);
+ {
+ if (!IMG_isPNG(rw))
+ {
+ logger->log("Error, image is not png: " + filename);
+ return nullptr;
+ }
+ surface = IMG_LoadPNG_RW(rw);
+ SDL_RWclose(rw);
+ }
return surface;
}