diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-25 09:39:23 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-25 09:39:23 +1000 |
commit | a81490c35ca93174265f18d98a542d383a11bdfa (patch) | |
tree | 54b75354b8a2273c5c5055c0f0caa9ba88f02e5e /source/rendering/StarFontTextureGroup.cpp | |
parent | 1b86da7f3634b8bc19473fde10b0a9079b0f4580 (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/rendering/StarFontTextureGroup.cpp')
-rw-r--r-- | source/rendering/StarFontTextureGroup.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/rendering/StarFontTextureGroup.cpp b/source/rendering/StarFontTextureGroup.cpp index cdc667a..60f66f6 100644 --- a/source/rendering/StarFontTextureGroup.cpp +++ b/source/rendering/StarFontTextureGroup.cpp @@ -64,12 +64,17 @@ const FontTextureGroup::GlyphTexture& FontTextureGroup::glyphTexture(String::Cha for (auto& entry : directives->entries) { if (auto error = entry.operation.ptr<ErrorImageOperation>()) { - if (error->exception) { + if (auto string = error->cause.ptr<std::string>()) { + if (!string->empty()) { + Logger::error("Error parsing font directives: {}", *string); + string->clear(); + } + } else if (auto& exception = error->cause.get<std::exception_ptr>()) { try - { std::rethrow_exception(error->exception); } + { std::rethrow_exception(error->cause.get<std::exception_ptr>()); } catch (std::exception const& e) - { Logger::error("Exception parsing font directives: {}", e.what()); } - error->exception = {}; + { Logger::error("Exception parsing font directives: {}", e.what()); }; + exception = {}; } image.forEachPixel([](unsigned x, unsigned y, Vec4B& pixel) { pixel = ((x + y) % 2 == 0) ? Vec4B(255, 0, 255, pixel[3]) : Vec4B(0, 0, 0, pixel[3]); |