summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-30 20:09:37 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-30 20:09:37 +0200
commit91636a1ae39df104a8696f8a8a7336f42bf5ab2c (patch)
tree8dc43c43b16645cc8ff79478759588d0eb5545bb /unity-shared
parent2006cce548b4f3d4b5419c513ca79d6146c88c83 (diff)
TextureCache: use just a vector for managing themed_files_
(bzr r4093.2.5)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/TextureCache.cpp11
-rw-r--r--unity-shared/TextureCache.h3
2 files changed, 7 insertions, 7 deletions
diff --git a/unity-shared/TextureCache.cpp b/unity-shared/TextureCache.cpp
index cf6a9c138..13986aead 100644
--- a/unity-shared/TextureCache.cpp
+++ b/unity-shared/TextureCache.cpp
@@ -66,17 +66,18 @@ nux::BaseTexture* TextureCache::LocalLoader(std::string const& name, int w, int
nux::BaseTexture* TextureCache::ThemedLoader(std::string const& name, int w, int h)
{
auto& cache = GetDefault();
- cache.themed_files_.insert(Hash(name, w, h));
+ cache.themed_files_.push_back(Hash(name, w, h));
auto const& themed_file = theme::Settings::Get()->ThemedFilePath(name, {PKGDATADIR}, {""});
return themed_file.empty() ? LocalLoader(name, w, h) : create_2d_texture(themed_file, w, h);
}
void TextureCache::OnThemeChanged(std::string const&)
{
- for (auto texture_key : themed_files_)
- cache_.erase(texture_key);
-
- themed_files_.clear();
+ for (auto it = begin(themed_files_); it != end(themed_files_);)
+ {
+ cache_.erase(*it);
+ it = themed_files_.erase(it);
+ }
}
TextureCache::BaseTexturePtr TextureCache::FindTexture(std::string const& texture_id,
diff --git a/unity-shared/TextureCache.h b/unity-shared/TextureCache.h
index aff029742..d2de5a810 100644
--- a/unity-shared/TextureCache.h
+++ b/unity-shared/TextureCache.h
@@ -23,7 +23,6 @@
#include <string>
#include <unordered_map>
-#include <unordered_set>
#include <Nux/Nux.h>
#include <sigc++/trackable.h>
@@ -63,7 +62,7 @@ private:
void OnThemeChanged(std::string const&);
std::unordered_map<std::size_t, nux::BaseTexture*> cache_;
- std::unordered_set<std::size_t> themed_files_;
+ std::vector<std::size_t> themed_files_;
};
}