Clear the gameinfo cache on device lost.

This commit is contained in:
Henrik Rydgard committed 2013-04-14 11:58:28 +02:00
1 parent ed1360a478
commit b88f428a67
4 files changed
+28 -3

No files matched your search

+22 -3
View File
@@ -147,9 +147,7 @@ private:
GameInfoCache::~GameInfoCache() {
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
delete iter->second;
}
Clear();
}
void GameInfoCache::Init() {
@@ -174,6 +172,27 @@ void GameInfoCache::Decimate() {
// TODO
}
void GameInfoCache::Clear() {
gameInfoWQ_->Flush();
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
lock_guard lock(iter->second->lock);
if (!iter->second->pic0TextureData.empty()) {
iter->second->pic0TextureData.clear();
}
if (iter->second->pic0Texture) {
delete iter->second->pic0Texture;
iter->second->pic0Texture = 0;
}
if (!iter->second->pic1TextureData.empty()) {
iter->second->pic1TextureData.clear();
}
if (iter->second->pic1Texture) {
delete iter->second->pic1Texture;
iter->second->pic1Texture = 0;
}
}
}
void GameInfoCache::FlushBGs() {
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
lock_guard lock(iter->second->lock);