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

summaryrefslogtreecommitdiff
path: root/source/core/StarImageProcessing.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 03:38:57 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 03:38:57 +1000
commit4585c9cafa87cad6b54397af7e9375cc31b72f89 (patch)
treebefd016a13e95467197b2bd507198b53b262fead /source/core/StarImageProcessing.cpp
parent14e23a17ccf7d556d98e7dc76f1e7ad81fa70e93 (diff)
Lazy-loading of ImageOperation inside Directives
also fixed cases of drawables not staying centered after adding directives that scale
Diffstat (limited to 'source/core/StarImageProcessing.cpp')
-rw-r--r--source/core/StarImageProcessing.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/core/StarImageProcessing.cpp b/source/core/StarImageProcessing.cpp
index 4dfcf8a..e95a13f 100644
--- a/source/core/StarImageProcessing.cpp
+++ b/source/core/StarImageProcessing.cpp
@@ -198,8 +198,11 @@ ImageOperation imageOperationFromString(StringView string) {
else if (hexLen == 8) {
hexDecode(hexPtr, 8, c, 4);
}
- else
- throw ImageOperationException(strf("Improper size for hex string '%s' in imageOperationFromString", StringView(hexPtr, hexLen)), false);
+ else if (!which || (ptr != end && ++ptr != end))
+ throw ImageOperationException(strf("Improper size for hex string '%s' 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 move(operation);
+
if (which = !which)
operation.colorReplaceMap[*(Vec4B*)&a] = *(Vec4B*)&b;