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/resourcemanager.cpp | |
parent | e2f03241a1ba9d6b536b0b7a6f995e4e8d894408 (diff) | |
download | mv-bb8be1acea37f09c134d7d4042869a679cf8a12b.tar.gz mv-bb8be1acea37f09c134d7d4042869a679cf8a12b.tar.bz2 mv-bb8be1acea37f09c134d7d4042869a679cf8a12b.tar.xz mv-bb8be1acea37f09c134d7d4042869a679cf8a12b.zip |
Move sub images load function from resourcemanager into separate file.
Diffstat (limited to 'src/resources/resourcemanager/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.cpp | 42 |
1 files changed, 0 insertions, 42 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 { |