summaryrefslogtreecommitdiff
path: root/wx+/image_resources.cpp
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2018-10-16 17:33:51 -0400
committerB Stack <bgstack15@gmail.com>2018-10-16 17:33:51 -0400
commit878a41d3be13da2a654df74f2a35ea8b295c8a13 (patch)
tree89b2a018482c164bdd8ecac5c76b19a08f420dec /wx+/image_resources.cpp
parentMerge branch '10.4' into 'master' (diff)
downloadFreeFileSync-878a41d3be13da2a654df74f2a35ea8b295c8a13.tar.gz
FreeFileSync-878a41d3be13da2a654df74f2a35ea8b295c8a13.tar.bz2
FreeFileSync-878a41d3be13da2a654df74f2a35ea8b295c8a13.zip
10.5
Diffstat (limited to 'wx+/image_resources.cpp')
-rwxr-xr-xwx+/image_resources.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp
index d0449fe5..d09a188b 100755
--- a/wx+/image_resources.cpp
+++ b/wx+/image_resources.cpp
@@ -122,14 +122,12 @@ public:
result_.access([&](std::vector<std::pair<std::wstring, ImageHolder>>& r)
{
- for (auto& item : r)
+ for (auto& [imageName, ih] : r)
{
- ImageHolder& ih = item.second;
-
wxImage img(ih.getWidth(), ih.getHeight(), ih.releaseRgb(), false /*static_data*/); //pass ownership
img.SetAlpha(ih.releaseAlpha(), false /*static_data*/);
- output.emplace(item.first, std::move(img));
+ output.emplace(imageName, std::move(img));
}
});
return output;
@@ -171,7 +169,8 @@ class GlobalBitmaps
public:
static std::shared_ptr<GlobalBitmaps> instance()
{
- static Global<GlobalBitmaps> inst(std::make_unique<GlobalBitmaps>());
+ static FunStatGlobal<GlobalBitmaps> inst;
+ inst.initOnce([] { return std::make_unique<GlobalBitmaps>(); });
assert(runningMainThread()); //wxWidgets is not thread-safe!
return inst.get();
}
@@ -179,7 +178,7 @@ public:
GlobalBitmaps() {}
~GlobalBitmaps() { assert(bitmaps_.empty() && anims_.empty()); } //don't leave wxWidgets objects for static destruction!
- void init(const Zstring& filepath);
+ void init(const Zstring& filePath);
void cleanup()
{
bitmaps_.clear();
@@ -239,6 +238,8 @@ void GlobalBitmaps::init(const Zstring& filePath)
}
else if (endsWith(name, L".gif"))
loadAnimFromZip(streamIn, anims_[name]);
+ else
+ assert(false);
}
}
}
bgstack15