summaryrefslogtreecommitdiff
path: root/wx+/image_resources.cpp
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-09-07 14:49:22 -0400
committerB. Stack <bgstack15@gmail.com>2022-09-07 14:49:22 -0400
commit47c88c433d17948fab1d8e1d76121a72fe5938cb (patch)
treefbc1dea58a6b28f1af4a9e9b2bc8e3e1d23b2103 /wx+/image_resources.cpp
parentMerge branch 'b11.23' into 'master' (diff)
downloadFreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.tar.gz
FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.tar.bz2
FreeFileSync-47c88c433d17948fab1d8e1d76121a72fe5938cb.zip
add upstream 11.24
Diffstat (limited to 'wx+/image_resources.cpp')
-rw-r--r--wx+/image_resources.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp
index 36055f3f..58ae4d25 100644
--- a/wx+/image_resources.cpp
+++ b/wx+/image_resources.cpp
@@ -70,7 +70,7 @@ ImageHolder xbrzScale(int width, int height, const unsigned char* imageRgb, cons
}
-auto getScalerTask(const std::string& imageName, const wxImage& img, int hqScale, Protected<std::vector<std::pair<std::string, ImageHolder>>>& result)
+auto createScalerTask(const std::string& imageName, const wxImage& img, int hqScale, Protected<std::vector<std::pair<std::string, ImageHolder>>>& result)
{
assert(runningOnMainThread());
return [imageName,
@@ -97,7 +97,7 @@ public:
{
assert(runningOnMainThread());
imgKeeper_.push_back(img); //retain (ref-counted) wxImage so that the rgb/alpha pointers remain valid after passed to threads
- threadGroup_->run(getScalerTask(imageName, img, hqScale_, result_));
+ threadGroup_->run(createScalerTask(imageName, img, hqScale_, result_));
}
std::unordered_map<std::string, wxImage> waitAndGetResult()
@@ -125,7 +125,7 @@ private:
std::vector<wxImage> imgKeeper_;
Protected<std::vector<std::pair<std::string, ImageHolder>>> result_;
- using TaskType = FunctionReturnTypeT<decltype(&getScalerTask)>;
+ using TaskType = FunctionReturnTypeT<decltype(&createScalerTask)>;
std::optional<ThreadGroup<TaskType>> threadGroup_{ThreadGroup<TaskType>(std::max<int>(std::thread::hardware_concurrency(), 1), Zstr("xBRZ Scaler"))};
//hardware_concurrency() == 0 if "not computable or well defined"
};
@@ -192,11 +192,13 @@ ImageBuffer::ImageBuffer(const Zstring& zipPath) //throw FileError
else
assert(false);
}
- catch (FileError&) //fall back to folder
+ catch (FileError&) //fall back to folder: dev build (only!?)
{
const Zstring fallbackFolder = beforeLast(zipPath, Zstr(".zip"), IfNotFoundReturn::none);
- if (dirAvailable(fallbackFolder)) //Debug build (only!?)
- traverseFolder(fallbackFolder, [&](const FileInfo& fi)
+ if (!itemStillExists(fallbackFolder)) //throw FileError
+ throw;
+
+ traverseFolder(fallbackFolder, [&](const FileInfo& fi)
{
if (endsWith(fi.fullPath, Zstr(".png")))
{
@@ -204,8 +206,6 @@ ImageBuffer::ImageBuffer(const Zstring& zipPath) //throw FileError
streams.emplace_back(fi.itemName, std::move(stream));
}
}, nullptr, nullptr, [](const std::wstring& errorMsg) { throw FileError(errorMsg); });
- else
- throw;
}
//--------------------------------------------------------------------
bgstack15