From 878a41d3be13da2a654df74f2a35ea8b295c8a13 Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 16 Oct 2018 17:33:51 -0400 Subject: 10.5 --- wx+/image_resources.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'wx+/image_resources.cpp') 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>& 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 instance() { - static Global inst(std::make_unique()); + static FunStatGlobal inst; + inst.initOnce([] { return std::make_unique(); }); 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); } } } -- cgit