diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-07-14 01:31:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-07-14 01:31:22 +0300 |
commit | 311c175f3184103950c72bc5c775174597430b83 (patch) | |
tree | ad022dc44a1c4177b3d53bf0d7eaa5a1736c8cf1 /src/resources/atlas | |
parent | 16bcb81b0509725e4546bcb3c390ca3c1bb7e7b1 (diff) | |
download | plus-311c175f3184103950c72bc5c775174597430b83.tar.gz plus-311c175f3184103950c72bc5c775174597430b83.tar.bz2 plus-311c175f3184103950c72bc5c775174597430b83.tar.xz plus-311c175f3184103950c72bc5c775174597430b83.zip |
Replace std::vector into macro STD_VECTOR.
In most case it equal to std::vector except debug modes.
Now it can be also mse::mstd::vector, but sadly this class not support
all required features.
Diffstat (limited to 'src/resources/atlas')
-rw-r--r-- | src/resources/atlas/atlasmanager.cpp | 46 | ||||
-rw-r--r-- | src/resources/atlas/atlasmanager.h | 12 | ||||
-rw-r--r-- | src/resources/atlas/atlasresource.cpp | 6 | ||||
-rw-r--r-- | src/resources/atlas/atlasresource.h | 2 | ||||
-rw-r--r-- | src/resources/atlas/textureatlas.h | 4 |
5 files changed, 35 insertions, 35 deletions
diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp index c7d237115..888af7fe7 100644 --- a/src/resources/atlas/atlasmanager.cpp +++ b/src/resources/atlas/atlasmanager.cpp @@ -61,8 +61,8 @@ AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name, const StringVect &files) { BLOCK_START("AtlasManager::loadTextureAtlas") - std::vector<TextureAtlas*> atlases; - std::vector<Image*> images; + STD_VECTOR<TextureAtlas*> atlases; + STD_VECTOR<Image*> images; AtlasResource *resource = new AtlasResource; loadImages(files, images); @@ -76,7 +76,7 @@ AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name, // sorting images on atlases. simpleSort(name, atlases, images, maxSize); - FOR_EACH (std::vector<TextureAtlas*>::iterator, it, atlases) + FOR_EACH (STD_VECTOR<TextureAtlas*>::iterator, it, atlases) { TextureAtlas *const atlas = *it; if (atlas == nullptr) @@ -96,8 +96,8 @@ AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name, AtlasResource *AtlasManager::loadEmptyAtlas(const std::string &name, const StringVect &files) { - std::vector<TextureAtlas*> atlases; - std::vector<Image*> images; + STD_VECTOR<TextureAtlas*> atlases; + STD_VECTOR<Image*> images; AtlasResource *resource = new AtlasResource; loadEmptyImages(files, images); @@ -105,7 +105,7 @@ AtlasResource *AtlasManager::loadEmptyAtlas(const std::string &name, // sorting images on atlases. emptySort(name, atlases, images); - FOR_EACH (std::vector<TextureAtlas*>::iterator, it, atlases) + FOR_EACH (STD_VECTOR<TextureAtlas*>::iterator, it, atlases) { TextureAtlas *const atlas = *it; if (atlas == nullptr) @@ -125,7 +125,7 @@ AtlasResource *AtlasManager::loadEmptyAtlas(const std::string &name, } void AtlasManager::loadImages(const StringVect &files, - std::vector<Image*> &images) + STD_VECTOR<Image*> &images) { BLOCK_START("AtlasManager::loadImages") @@ -175,7 +175,7 @@ void AtlasManager::loadImages(const StringVect &files, } void AtlasManager::loadEmptyImages(const StringVect &files, - std::vector<Image*> &images) + STD_VECTOR<Image*> &images) { BLOCK_START("AtlasManager::loadEmptyImages") @@ -202,8 +202,8 @@ void AtlasManager::loadEmptyImages(const StringVect &files, } void AtlasManager::simpleSort(const std::string &restrict name, - std::vector<TextureAtlas*> &restrict atlases, - const std::vector<Image*> &restrict images, + STD_VECTOR<TextureAtlas*> &restrict atlases, + const STD_VECTOR<Image*> &restrict images, int size) { BLOCK_START("AtlasManager::simpleSort") @@ -211,8 +211,8 @@ void AtlasManager::simpleSort(const std::string &restrict name, int y = 0; int tempHeight = 0; TextureAtlas *atlas = new TextureAtlas; - std::vector<Image*>::const_iterator it = images.begin(); - const std::vector<Image*>::const_iterator it_end = images.end(); + STD_VECTOR<Image*>::const_iterator it = images.begin(); + const STD_VECTOR<Image*>::const_iterator it_end = images.end(); for (it = images.begin(); it != it_end; ++ it) { const Image *const img = *it; @@ -273,13 +273,13 @@ void AtlasManager::simpleSort(const std::string &restrict name, } void AtlasManager::emptySort(const std::string &restrict name, - std::vector<TextureAtlas*> &restrict atlases, - const std::vector<Image*> &restrict images) + STD_VECTOR<TextureAtlas*> &restrict atlases, + const STD_VECTOR<Image*> &restrict images) { BLOCK_START("AtlasManager::simpleSort") TextureAtlas *atlas = new TextureAtlas; - std::vector<Image*>::const_iterator it = images.begin(); - const std::vector<Image*>::const_iterator it_end = images.end(); + STD_VECTOR<Image*>::const_iterator it = images.begin(); + const STD_VECTOR<Image*>::const_iterator it_end = images.end(); for (it = images.begin(); it != it_end; ++ it) { const Image *const img = *it; @@ -370,7 +370,7 @@ void AtlasManager::createSDLAtlas(TextureAtlas *const atlas) } // drawing SDL images to surface - FOR_EACH (std::vector<AtlasItem*>::iterator, it, atlas->items) + FOR_EACH (STD_VECTOR<AtlasItem*>::iterator, it, atlas->items) { AtlasItem *const item = *it; imageHelper->copySurfaceToImage(image, item->x, item->y, @@ -424,7 +424,7 @@ void AtlasManager::convertEmptyAtlas(TextureAtlas *const atlas) image->incRef(); - FOR_EACH (std::vector<AtlasItem*>::iterator, it, atlas->items) + FOR_EACH (STD_VECTOR<AtlasItem*>::iterator, it, atlas->items) { AtlasItem *const item = *it; // delete SDL Image @@ -471,7 +471,7 @@ void AtlasManager::convertAtlas(TextureAtlas *const atlas) image->incRef(); - FOR_EACH (std::vector<AtlasItem*>::iterator, it, atlas->items) + FOR_EACH (STD_VECTOR<AtlasItem*>::iterator, it, atlas->items) { AtlasItem *const item = *it; // delete SDL Image @@ -497,7 +497,7 @@ void AtlasManager::injectToResources(const AtlasResource *const resource) { if (resource == nullptr) return; - FOR_EACH (std::vector<TextureAtlas*>::const_iterator, + FOR_EACH (STD_VECTOR<TextureAtlas*>::const_iterator, it, resource->atlases) { // add each atlas image to resources @@ -507,7 +507,7 @@ void AtlasManager::injectToResources(const AtlasResource *const resource) Image *const image = atlas->atlasImage; if (image != nullptr) ResourceManager::addResource(atlas->name, image); - FOR_EACH (std::vector<AtlasItem*>::iterator, it2, atlas->items) + FOR_EACH (STD_VECTOR<AtlasItem*>::iterator, it2, atlas->items) { AtlasItem *const item = *it2; if (item == nullptr) @@ -523,7 +523,7 @@ void AtlasManager::moveToDeleted(AtlasResource *const resource) { if (resource == nullptr) return; - FOR_EACH (std::vector<TextureAtlas*>::iterator, it, resource->atlases) + FOR_EACH (STD_VECTOR<TextureAtlas*>::iterator, it, resource->atlases) { // move each atlas image to deleted TextureAtlas *const atlas = *it; @@ -535,7 +535,7 @@ void AtlasManager::moveToDeleted(AtlasResource *const resource) // move each atlas image to deleted ResourceManager::moveToDeleted(image); } - FOR_EACH (std::vector<AtlasItem*>::iterator, it2, atlas->items) + FOR_EACH (STD_VECTOR<AtlasItem*>::iterator, it2, atlas->items) { AtlasItem *const item = *it2; if (item != nullptr) diff --git a/src/resources/atlas/atlasmanager.h b/src/resources/atlas/atlasmanager.h index 13db9717e..1e5de93b9 100644 --- a/src/resources/atlas/atlasmanager.h +++ b/src/resources/atlas/atlasmanager.h @@ -53,18 +53,18 @@ class AtlasManager final private: static void loadImages(const StringVect &files, - std::vector<Image*> &images); + STD_VECTOR<Image*> &images); static void loadEmptyImages(const StringVect &files, - std::vector<Image*> &images); + STD_VECTOR<Image*> &images); static void emptySort(const std::string &restrict name, - std::vector<TextureAtlas*> &restrict atlases, - const std::vector<Image*> &restrict images); + STD_VECTOR<TextureAtlas*> &restrict atlases, + const STD_VECTOR<Image*> &restrict images); static void simpleSort(const std::string &restrict name, - std::vector<TextureAtlas*> &restrict atlases, - const std::vector<Image*> &restrict images, + STD_VECTOR<TextureAtlas*> &restrict atlases, + const STD_VECTOR<Image*> &restrict images, int size); static void createSDLAtlas(TextureAtlas *const atlas) A_NONNULL(1); diff --git a/src/resources/atlas/atlasresource.cpp b/src/resources/atlas/atlasresource.cpp index 51a807975..b97823ebb 100644 --- a/src/resources/atlas/atlasresource.cpp +++ b/src/resources/atlas/atlasresource.cpp @@ -31,12 +31,12 @@ AtlasResource::~AtlasResource() { - FOR_EACH (std::vector<TextureAtlas*>::iterator, it, atlases) + FOR_EACH (STD_VECTOR<TextureAtlas*>::iterator, it, atlases) { TextureAtlas *const atlas = *it; if (atlas != nullptr) { - FOR_EACH (std::vector<AtlasItem*>::iterator, it2, atlas->items) + FOR_EACH (STD_VECTOR<AtlasItem*>::iterator, it2, atlas->items) { AtlasItem *const item = *it2; if (item != nullptr) @@ -80,7 +80,7 @@ int AtlasResource::calcMemoryLocal() const int AtlasResource::calcMemoryChilds(const int level) const { int sz = 0; - FOR_EACH (std::vector<TextureAtlas*>::const_iterator, it, atlases) + FOR_EACH (STD_VECTOR<TextureAtlas*>::const_iterator, it, atlases) { TextureAtlas *const atlas = *it; sz += atlas->calcMemory(level + 1); diff --git a/src/resources/atlas/atlasresource.h b/src/resources/atlas/atlasresource.h index ba0d441ea..60be25c1d 100644 --- a/src/resources/atlas/atlasresource.h +++ b/src/resources/atlas/atlasresource.h @@ -48,7 +48,7 @@ class AtlasResource final : public Resource int calcMemoryChilds(const int level) const override final; - std::vector<TextureAtlas*> atlases; + STD_VECTOR<TextureAtlas*> atlases; }; #endif // USE_OPENGL diff --git a/src/resources/atlas/textureatlas.h b/src/resources/atlas/textureatlas.h index a1fe4d145..ff74049d5 100644 --- a/src/resources/atlas/textureatlas.h +++ b/src/resources/atlas/textureatlas.h @@ -59,7 +59,7 @@ struct TextureAtlas final : public MemoryCounter int calcMemoryChilds(const int level) const override final { int sz = 0; - FOR_EACH (std::vector<AtlasItem*>::const_iterator, it, items) + FOR_EACH (STD_VECTOR<AtlasItem*>::const_iterator, it, items) { AtlasItem *const item = *it; sz += item->calcMemory(level + 1); @@ -74,7 +74,7 @@ struct TextureAtlas final : public MemoryCounter Image *atlasImage; int width; int height; - std::vector <AtlasItem*> items; + STD_VECTOR <AtlasItem*> items; }; #endif // USE_OPENGL |