summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-30 20:38:17 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-30 20:38:17 +0200
commitf563f04ce7dfeb9c48a018269b4bf03091466d29 (patch)
tree52d2e42c8ce9957a0797aeb18c4ad4409342639c /unity-shared
parent74ca5ddcb486a3bf66e4dca65782b2175ca88433 (diff)
IconRenderer: no need to keep track of textures names/sizes anymore as we don't have to invalidate them
(bzr r4093.2.9)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/IconRenderer.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/unity-shared/IconRenderer.cpp b/unity-shared/IconRenderer.cpp
index 7d0eb215a..a417ae792 100644
--- a/unity-shared/IconRenderer.cpp
+++ b/unity-shared/IconRenderer.cpp
@@ -249,9 +249,10 @@ struct IconRenderer::LocalTextures
{
LocalTextures(IconRenderer* parent)
: parent_(parent)
+ , textures_loaded_(false)
{
connections_.Add(theme::Settings::Get()->theme.changed.connect([this] (std::string const&) {
- if (!texture_files_.empty())
+ if (textures_loaded_)
ReloadIconSizedTextures(parent_->icon_size, parent_->image_size);
}));
@@ -272,7 +273,8 @@ struct IconRenderer::LocalTextures
int marker_size = std::round(icon_size * (MARKER_SIZES[tex_size] / static_cast<double>(TILE_SIZES[tex_size])));
auto const& marker_sufix = std::to_string(MARKER_SIZES[tex_size]);
- texture_files_ = {
+ struct TextureData { BaseTexturePtr* tex_ptr; std::string name; int size; };
+ std::vector<TextureData> texture_files = {
{&icon_background, "launcher_icon_back_"+tile_sufix, icon_size},
{&icon_selected_background, "launcher_icon_selected_back_"+tile_sufix, icon_size},
{&icon_edge, "launcher_icon_edge_"+tile_sufix, icon_size},
@@ -292,8 +294,10 @@ struct IconRenderer::LocalTextures
};
auto& cache = TextureCache::GetDefault();
- for (auto const& tex_data : texture_files_)
+ for (auto const& tex_data : texture_files)
*tex_data.tex_ptr = cache.FindTexture(tex_data.name, tex_data.size, tex_data.size);
+
+ textures_loaded_ = true;
}
nux::BaseTexture* RenderLabelTexture(char label, int icon_size, nux::Color const&);
@@ -331,8 +335,7 @@ struct IconRenderer::LocalTextures
private:
IconRenderer* parent_;
- struct TextureData { BaseTexturePtr* tex_ptr; std::string name; int size; };
- std::vector<TextureData> texture_files_;
+ bool textures_loaded_;
std::vector<BaseTexturePtr> labels_;
connection::Manager connections_;
};