Commit 9623487f authored by fallenstardust's avatar fallenstardust

尝试优化clearTextures

parent b542e0f0
...@@ -94,19 +94,24 @@ void ImageManager::SetDevice(irr::IrrlichtDevice* dev) { ...@@ -94,19 +94,24 @@ void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
driver = dev->getVideoDriver(); driver = dev->getVideoDriver();
} }
void ImageManager::ClearTexture() { void ImageManager::ClearTexture() {
for(auto tit = tMap.begin(); tit != tMap.end(); ++tit) { for(auto & tit : tMap) {
if(tit->second) if(tit.second)
driver->removeTexture(tit->second); driver->removeTexture(tit.second);
} }
for(auto tit = tThumb.begin(); tit != tThumb.end(); ++tit) { for(auto & tit : tThumb) {
if(tit->second) if(tit.second)
driver->removeTexture(tit->second); driver->removeTexture(tit.second);
}
for(auto & field : tFields) {
if(field.second)
driver->removeTexture(field.second);
} }
tMap.clear(); tMap.clear();
tThumb.clear(); tThumb.clear();
if(tBigPicture != NULL) { tFields.clear();
if(tBigPicture != nullptr) {
driver->removeTexture(tBigPicture); driver->removeTexture(tBigPicture);
tBigPicture = NULL; tBigPicture = nullptr;
} }
} }
void ImageManager::RemoveTexture(int code) { void ImageManager::RemoveTexture(int code) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment