diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-18 21:12:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-18 21:12:39 +0300 |
commit | cba820971cfc204050aa9bbaccb55ba35fba4ae1 (patch) | |
tree | 2e0f2abf0431e743584e0e061471288235ce146d /src/resources/atlasmanager.cpp | |
parent | 74165476686480cf06c19bfc8658936597b72b03 (diff) | |
download | manaplus-cba820971cfc204050aa9bbaccb55ba35fba4ae1.tar.gz manaplus-cba820971cfc204050aa9bbaccb55ba35fba4ae1.tar.bz2 manaplus-cba820971cfc204050aa9bbaccb55ba35fba4ae1.tar.xz manaplus-cba820971cfc204050aa9bbaccb55ba35fba4ae1.zip |
Move atlasresource into separate file.
Diffstat (limited to 'src/resources/atlasmanager.cpp')
-rw-r--r-- | src/resources/atlasmanager.cpp | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp index 81ae0f2f6..e2a801a78 100644 --- a/src/resources/atlasmanager.cpp +++ b/src/resources/atlasmanager.cpp @@ -31,6 +31,7 @@ #include "utils/physfsrwops.h" #include "utils/sdlcheckutils.h" +#include "resources/atlasresource.h" #include "resources/dye.h" #include "resources/imagehelper.h" #include "resources/openglimagehelper.h" @@ -355,46 +356,4 @@ void AtlasManager::moveToDeleted(AtlasResource *const resource) } } -AtlasResource::~AtlasResource() -{ - FOR_EACH (std::vector<TextureAtlas*>::iterator, it, atlases) - { - TextureAtlas *const atlas = *it; - if (atlas) - { - FOR_EACH (std::vector<AtlasItem*>::iterator, it2, atlas->items) - { - AtlasItem *const item = *it2; - if (item) - { - Image *const image2 = item->image; - if (image2) - image2->decRef(); - delete item; - } - } - Image *const image = atlas->atlasImage; - if (image) - image->decRef(); - delete atlas; - } - } - ResourceManager *const resman = ResourceManager::getInstance(); - resman->clearDeleted(false); -} - -void AtlasResource::incRef() -{ - if (!getRefCount()) - AtlasManager::injectToResources(this); - Resource::incRef(); -} - -void AtlasResource::decRef() -{ - Resource::decRef(); - if (!getRefCount()) - AtlasManager::moveToDeleted(this); -} - #endif |