summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index d820adcfb..ad5d0d91c 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -29,6 +29,7 @@
#ifdef USE_OPENGL
#include "resources/openglimagehelper.h"
#endif // USE_OPENGL
+#include "resources/memorymanager.h"
#include "resources/sdlimagehelper.h"
#include "resources/subimage.h"
@@ -473,6 +474,19 @@ void Image::SDLTerminateAlphaCache()
mUseAlphaCache = false;
}
+int Image::calcMemoryLocal()
+{
+ // +++ this calculation can be wrong for SDL2
+ int sz = sizeof(Image) +
+ sizeof(std::map<float, SDL_Surface*>);
+ if (mSDLSurface)
+ {
+ sz += CAST_S32(mAlphaCache.size()) *
+ memoryManager.getSurfaceSize(mSDLSurface);
+ }
+ return sz;
+}
+
#ifdef USE_OPENGL
void Image::decRef()
{