From 791b90b9898cc41869538f1dfc303588436682b7 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sat, 15 Feb 2020 11:50:31 -0500 Subject: add upstream 10.20 It is worth noting that the send email feature is not present in the GPL release. --- wx+/image_resources.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'wx+/image_resources.cpp') diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp index 2a3b7039..070b9112 100644 --- a/wx+/image_resources.cpp +++ b/wx+/image_resources.cpp @@ -187,7 +187,7 @@ void GlobalBitmaps::init(const Zstring& zipPath) { assert(bitmaps_.empty() && anims_.empty()); - std::vector> streams; + std::vector> streams; try //to load from ZIP first: { @@ -199,7 +199,7 @@ void GlobalBitmaps::init(const Zstring& zipPath) while (const auto& entry = std::unique_ptr(zipStream.GetNextEntry())) //take ownership! if (std::string stream(entry->GetSize(), '\0'); !stream.empty() && zipStream.ReadAll(&stream[0], stream.size())) - streams.emplace_back(utfTo(entry->GetName()), std::move(stream)); + streams.emplace_back(entry->GetName(), std::move(stream)); else assert(false); } @@ -211,7 +211,7 @@ void GlobalBitmaps::init(const Zstring& zipPath) try { std::string stream = loadBinContainer(fi.fullPath, nullptr /*notifyUnbufferedIO*/); //throw FileError - streams.emplace_back(fi.itemName, std::move(stream)); + streams.emplace_back(utfTo(fi.itemName), std::move(stream)); } catch (FileError&) { assert(false); } }, nullptr, nullptr, [](const std::wstring& errorMsg) { assert(false); }); //errors are not really critical in this context @@ -229,12 +229,10 @@ void GlobalBitmaps::init(const Zstring& zipPath) for (const auto& [fileName, stream] : streams) { - const wxString& name = utfTo(afterLast(fileName, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_ALL)); - wxMemoryInputStream wxstream(stream.c_str(), stream.size()); //stream does not take ownership of data //bonus: work around wxWidgets bug: wxAnimation::Load() requires seekable input stream (zip-input stream is not seekable) - if (endsWith(name, L".png")) + if (endsWith(fileName, L".png")) { wxImage img(wxstream, wxBITMAP_TYPE_PNG); assert(img.IsOk()); @@ -244,14 +242,14 @@ void GlobalBitmaps::init(const Zstring& zipPath) convertToVanillaImage(img); if (dpiScaler_) - dpiScaler_->add(name, img); //scale in parallel! + dpiScaler_->add(fileName, img); //scale in parallel! else - bitmaps_.emplace(name, img); + bitmaps_.emplace(fileName, img); } #if 0 else if (endsWith(name, L".gif")) { - [[maybe_unused]] const bool loadSuccess = anims_[name].Load(wxstream, wxANIMATION_TYPE_GIF); + [[maybe_unused]] const bool loadSuccess = anims_[fileName].Load(wxstream, wxANIMATION_TYPE_GIF); assert(loadSuccess); } #endif -- cgit