summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2010-10-12 19:59:25 +0300
committerAndrei Karas <akaras@inbox.ru>2010-10-16 20:44:37 +0300
commit0d3d7c908ef6d294b14f55f09c9d83767fbc5f32 (patch)
tree35a175491e6d08cdbd79ab6c9de7e13560132236 /src/resources/resourcemanager.cpp
parentbdf409c9c4ce083881133879947cc0a6c2cce0f1 (diff)
downloadMana-0d3d7c908ef6d294b14f55f09c9d83767fbc5f32.tar.gz
Mana-0d3d7c908ef6d294b14f55f09c9d83767fbc5f32.tar.bz2
Mana-0d3d7c908ef6d294b14f55f09c9d83767fbc5f32.tar.xz
Mana-0d3d7c908ef6d294b14f55f09c9d83767fbc5f32.zip
Implement opacity cache for SDL surfaces.
Enabled by default. Can be disabled in configuration option "alphaCache" if set it to 0. Reviewed-by: Bertram
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index c63b626e..00e4726e 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -533,3 +533,18 @@ SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename)
return tmp;
}
+
+void ResourceManager::scheduleDelete(SDL_Surface* surface)
+{
+ mDeletedSurfaces.insert(surface);
+}
+
+void ResourceManager::clearScheduled()
+{
+ for (std::set<SDL_Surface*>::iterator i = mDeletedSurfaces.begin(),
+ i_end = mDeletedSurfaces.end(); i != i_end; ++i)
+ {
+ SDL_FreeSurface(*i);
+ }
+ mDeletedSurfaces.clear();
+}