diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-25 19:14:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-25 19:14:07 +0300 |
commit | bb8be1acea37f09c134d7d4042869a679cf8a12b (patch) | |
tree | 683667f9633605d9bdfd29a292063c81216e23a0 /src/resources/resourcemanager | |
parent | e2f03241a1ba9d6b536b0b7a6f995e4e8d894408 (diff) | |
download | plus-bb8be1acea37f09c134d7d4042869a679cf8a12b.tar.gz plus-bb8be1acea37f09c134d7d4042869a679cf8a12b.tar.bz2 plus-bb8be1acea37f09c134d7d4042869a679cf8a12b.tar.xz plus-bb8be1acea37f09c134d7d4042869a679cf8a12b.zip |
Move sub images load function from resourcemanager into separate file.
Diffstat (limited to 'src/resources/resourcemanager')
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.cpp | 42 | ||||
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.h | 3 |
2 files changed, 0 insertions, 45 deletions
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index 0cff0fb2c..e9b8c687b 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -596,48 +596,6 @@ ImageSet *ResourceManager::getSubImageSet(Image *const parent, SubImageSetLoader::load, &rl)); } -struct SubImageLoader final -{ - ResourceManager *manager; - Image *parent; - int x, y; - int width, height; - static Resource *load(const void *const v) - { - if (!v) - return nullptr; - - const SubImageLoader *const - rl = static_cast<const SubImageLoader *const>(v); - if (!rl->manager || !rl->parent) - return nullptr; - - Image *const res = rl->parent->getSubImage(rl->x, rl->y, - rl->width, rl->height); - if (!res) - { - reportAlways("SubImage loading error: %s", - rl->parent->getSource().c_str()); - } - return res; - } -}; - -Image *ResourceManager::getSubImage(Image *const parent, - const int x, const int y, - const int width, const int height) -{ - if (!parent) - return nullptr; - - const SubImageLoader rl = { this, parent, x, y, width, height}; - - std::stringstream ss; - ss << parent->getIdPath() << ",[" << x << "," << y << "," - << width << "x" << height << "]"; - return static_cast<Image*>(get(ss.str(), SubImageLoader::load, &rl)); -} - #ifdef USE_OPENGL struct AtlasLoader final { diff --git a/src/resources/resourcemanager/resourcemanager.h b/src/resources/resourcemanager/resourcemanager.h index 1cc4fab68..13c99df63 100644 --- a/src/resources/resourcemanager/resourcemanager.h +++ b/src/resources/resourcemanager/resourcemanager.h @@ -144,9 +144,6 @@ class ResourceManager final : public MemoryCounter const int width, const int height) A_WARN_UNUSED; - Image *getSubImage(Image *const parent, const int x, const int y, - const int width, const int height) A_WARN_UNUSED; - #ifdef USE_OPENGL Resource *getAtlas(const std::string &name, const StringVect &files) A_WARN_UNUSED; |