mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[cpp][sfml] Removed Atlas::dispose, merged into destructor. Destructor calls TextureLoader::unload now. Fixed up SFML backend accordingly.
This commit is contained in:
parent
d640ac4bce
commit
0284abe548
@ -112,10 +112,6 @@ public:
|
|||||||
/// @return The region, or NULL.
|
/// @return The region, or NULL.
|
||||||
AtlasRegion *findRegion(const String &name);
|
AtlasRegion *findRegion(const String &name);
|
||||||
|
|
||||||
void dispose();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<AtlasPage *> _pages;
|
Vector<AtlasPage *> _pages;
|
||||||
Vector<AtlasRegion *> _regions;
|
Vector<AtlasRegion *> _regions;
|
||||||
|
|||||||
@ -69,6 +69,11 @@ Atlas::Atlas(const char *data, int length, const char *dir, TextureLoader *textu
|
|||||||
}
|
}
|
||||||
|
|
||||||
Atlas::~Atlas() {
|
Atlas::~Atlas() {
|
||||||
|
if (_textureLoader) {
|
||||||
|
for (size_t i = 0, n = _pages.size(); i < n; ++i) {
|
||||||
|
_textureLoader->unload(_pages[i]->rendererObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_pages);
|
ContainerUtil::cleanUpVectorOfPointers(_pages);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_regions);
|
ContainerUtil::cleanUpVectorOfPointers(_regions);
|
||||||
}
|
}
|
||||||
@ -92,13 +97,6 @@ AtlasRegion *Atlas::findRegion(const String &name) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Atlas::dispose() {
|
|
||||||
if (!_textureLoader) return;
|
|
||||||
for (size_t i = 0, n = _pages.size(); i < n; ++i) {
|
|
||||||
_textureLoader->unload(_pages[i]->rendererObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Atlas::load(const char *begin, int length, const char *dir) {
|
void Atlas::load(const char *begin, int length, const char *dir) {
|
||||||
static const char *formatNames[] = {"", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888",
|
static const char *formatNames[] = {"", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888",
|
||||||
"RGBA8888"};
|
"RGBA8888"};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user