summaryrefslogtreecommitdiff
path: root/src/resources/atlas/atlasresource.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-25 23:48:28 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-25 23:48:28 +0300
commit81dca73da50d8f421a74993de8cd5a9d61ef1e2a (patch)
tree506308ca4243c57eb15c6c537e231f19255c1047 /src/resources/atlas/atlasresource.cpp
parenta73b1787f1b2c293f00f4e71186753c0df476b77 (diff)
downloadmv-81dca73da50d8f421a74993de8cd5a9d61ef1e2a.tar.gz
mv-81dca73da50d8f421a74993de8cd5a9d61ef1e2a.tar.bz2
mv-81dca73da50d8f421a74993de8cd5a9d61ef1e2a.tar.xz
mv-81dca73da50d8f421a74993de8cd5a9d61ef1e2a.zip
Add memory counting functions into AtlasResource and some other.
Diffstat (limited to 'src/resources/atlas/atlasresource.cpp')
-rw-r--r--src/resources/atlas/atlasresource.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/resources/atlas/atlasresource.cpp b/src/resources/atlas/atlasresource.cpp
index 089d12bb7..d48394698 100644
--- a/src/resources/atlas/atlasresource.cpp
+++ b/src/resources/atlas/atlasresource.cpp
@@ -71,4 +71,22 @@ void AtlasResource::decRef()
AtlasManager::moveToDeleted(this);
}
+int AtlasResource::calcMemoryLocal()
+{
+ return sizeof(AtlasResource) +
+ Resource::calcMemoryLocal() +
+ atlases.capacity() * sizeof(TextureAtlas*);
+}
+
+int AtlasResource::calcMemoryChilds(const int level)
+{
+ int sz = 0;
+ FOR_EACH (std::vector<TextureAtlas*>::iterator, it, atlases)
+ {
+ TextureAtlas *const atlas = *it;
+ sz += atlas->calcMemory(level + 1);
+ }
+ return sz;
+}
+
#endif