Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarImageProcessing.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-04-25 09:39:23 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-04-25 09:39:23 +1000
commita81490c35ca93174265f18d98a542d383a11bdfa (patch)
tree54b75354b8a2273c5c5055c0f0caa9ba88f02e5e /source/core/StarImageProcessing.cpp
parent1b86da7f3634b8bc19473fde10b0a9079b0f4580 (diff)
reduce some Directives exceptions down to error strings for perf
additionally, image operations that don't exist simply pass through now
Diffstat (limited to 'source/core/StarImageProcessing.cpp')
-rw-r--r--source/core/StarImageProcessing.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/source/core/StarImageProcessing.cpp b/source/core/StarImageProcessing.cpp
index 51cee0f..5ed8690 100644
--- a/source/core/StarImageProcessing.cpp
+++ b/source/core/StarImageProcessing.cpp
@@ -199,13 +199,11 @@ ImageOperation imageOperationFromString(StringView string) {
hexDecode(hexPtr, 8, c, 4);
}
else if (!which || (ptr != end && ++ptr != end))
- throw ImageOperationException(strf("Improper size for hex string '{}' in imageOperationFromString", StringView(hexPtr, hexLen)), false);
- else // we're in A of A=B. In vanilla only A=B pairs are evaluated, so only throw an exception if B is also there.
+ return ErrorImageOperation{strf("Improper size for hex string '{}'", StringView(hexPtr, hexLen))};
+ else // we're in A of A=B. In vanilla only A=B pairs are evaluated, so only throw an error if B is also there.
return operation;
-
- which = !which;
- if (which)
+ if (which = !which)
operation.colorReplaceMap[*(Vec4B*)&a] = *(Vec4B*)&b;
hexLen = 0;
@@ -341,12 +339,12 @@ ImageOperation imageOperationFromString(StringView string) {
return FlipImageOperation{FlipImageOperation::FlipXY};
} else {
- throw ImageOperationException(strf("Could not recognize ImageOperation type {}", type), false);
+ return NullImageOperation();
}
} catch (OutOfRangeException const& e) {
- throw ImageOperationException("Error reading ImageOperation", e);
+ return ErrorImageOperation{std::exception_ptr()};
} catch (BadLexicalCast const& e) {
- throw ImageOperationException("Error reading ImageOperation", e);
+ return ErrorImageOperation{std::exception_ptr()};
}
}