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

summaryrefslogtreecommitdiff
path: root/source/game/StarImageMetadataDatabase.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/game/StarImageMetadataDatabase.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/game/StarImageMetadataDatabase.cpp')
-rw-r--r--source/game/StarImageMetadataDatabase.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/game/StarImageMetadataDatabase.cpp b/source/game/StarImageMetadataDatabase.cpp
index e47c841..c5ebd84 100644
--- a/source/game/StarImageMetadataDatabase.cpp
+++ b/source/game/StarImageMetadataDatabase.cpp
@@ -121,6 +121,8 @@ AssetPath ImageMetadataDatabase::filterProcessing(AssetPath const& path) {
AssetPath newPath = { path.basePath, path.subPath, {} };
String filtered;
+ for (auto& directives : path.directives.list())
+ directives.loadOperations();
path.directives.forEach([&](auto const& entry, Directives const& directives) {
ImageOperation const& operation = entry.operation;
if (!(operation.is<HueShiftImageOperation>() ||
@@ -184,6 +186,8 @@ Vec2U ImageMetadataDatabase::calculateImageSize(AssetPath const& path) const {
OperationSizeAdjust(Vec2U& size) : imageSize(size), hasError(false) {};
+ void operator()(NullImageOperation const&) {}
+
void operator()(ErrorImageOperation const&) {}
void operator()(HueShiftImageOperation const&) {}
@@ -231,6 +235,9 @@ Vec2U ImageMetadataDatabase::calculateImageSize(AssetPath const& path) const {
OperationSizeAdjust osa(imageSize);
+ for (auto& directives : path.directives.list())
+ directives.loadOperations();
+
bool complete = path.directives.forEachAbortable([&](auto const& entry, Directives const& directives) -> bool {
entry.operation.call(osa);
return !osa.hasError;