summaryrefslogtreecommitdiff
path: root/src/resources/atlas/textureatlas.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/atlas/textureatlas.h')
-rw-r--r--src/resources/atlas/textureatlas.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/resources/atlas/textureatlas.h b/src/resources/atlas/textureatlas.h
index 78b6ff00a..2b9f05930 100644
--- a/src/resources/atlas/textureatlas.h
+++ b/src/resources/atlas/textureatlas.h
@@ -25,8 +25,9 @@
#include "utils/stringvector.h"
-#include <vector>
+#include "resources/memorycounter.h"
+#include <vector>
#include <SDL.h>
#include "localconsts.h"
@@ -37,9 +38,10 @@ class Resource;
struct AtlasItem;
-struct TextureAtlas final
+struct TextureAtlas final : public MemoryCounter
{
TextureAtlas() :
+ MemoryCounter(),
name(),
atlasImage(nullptr),
width(0),
@@ -50,6 +52,23 @@ struct TextureAtlas final
A_DELETE_COPY(TextureAtlas)
+ int calcMemoryLocal() override final
+ {
+ return sizeof(TextureAtlas) +
+ items.capacity() * sizeof(AtlasItem*);
+ }
+
+ int calcMemoryChilds(const int level) override final
+ {
+ int sz = 0;
+ FOR_EACH (std::vector<AtlasItem*>::iterator, it, items)
+ {
+ AtlasItem *const item = *it;
+ sz += item->calcMemory(level + 1);
+ }
+ return sz;
+ }
+
std::string name;
Image *atlasImage;
int width;