diff options
author | Andrei Karas <akaras@inbox.ru> | 2010-10-12 19:59:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2010-10-16 20:44:37 +0300 |
commit | 0d3d7c908ef6d294b14f55f09c9d83767fbc5f32 (patch) | |
tree | 35a175491e6d08cdbd79ab6c9de7e13560132236 /src/resources/image.h | |
parent | bdf409c9c4ce083881133879947cc0a6c2cce0f1 (diff) | |
download | mana-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/image.h')
-rw-r--r-- | src/resources/image.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/resources/image.h b/src/resources/image.h index 3e8ad551..815b7764 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -39,6 +39,8 @@ #include <SDL_opengl.h> #endif +#include <map> + class Dye; class Position; @@ -169,6 +171,15 @@ class Image : public Resource Uint8 *SDLgetAlphaChannel() const { return mAlphaChannel; } + SDL_Surface* duplicateSurface(SDL_Surface* tmpImage); + + void cleanCache(); + + void terminateAlphaCache(); + + static void setEnableAlphaCache(bool n) + { mEnableAlphaCache = n; } + #ifdef USE_OPENGL // OpenGL only public functions @@ -208,14 +219,22 @@ class Image : public Resource /** SDL_Surface to SDL_Surface Image loader */ static Image *_SDLload(SDL_Surface *tmpImage); + SDL_Surface *getByAlpha(float alpha); + SDL_Surface *mSDLSurface; /** Alpha Channel pointer used for 32bit based SDL surfaces */ Uint8 *mAlphaChannel; - // ----------------------- - // OpenGL protected members - // ----------------------- + std::map<float, SDL_Surface*> mAlphaCache; + + bool mUseAlphaCache; + + static bool mEnableAlphaCache; + + // ----------------------- + // OpenGL protected members + // ----------------------- #ifdef USE_OPENGL /** * OpenGL Constructor. |