diff options
author | B Stack <bgstack15@gmail.com> | 2018-10-16 17:33:51 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2018-10-16 17:33:51 -0400 |
commit | 878a41d3be13da2a654df74f2a35ea8b295c8a13 (patch) | |
tree | 89b2a018482c164bdd8ecac5c76b19a08f420dec /wx+/image_resources.cpp | |
parent | Merge branch '10.4' into 'master' (diff) | |
download | FreeFileSync-878a41d3be13da2a654df74f2a35ea8b295c8a13.tar.gz FreeFileSync-878a41d3be13da2a654df74f2a35ea8b295c8a13.tar.bz2 FreeFileSync-878a41d3be13da2a654df74f2a35ea8b295c8a13.zip |
10.5
Diffstat (limited to 'wx+/image_resources.cpp')
-rwxr-xr-x | wx+/image_resources.cpp | 13 |
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); } } } |