From a81490c35ca93174265f18d98a542d383a11bdfa Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:39:23 +1000 Subject: reduce some Directives exceptions down to error strings for perf additionally, image operations that don't exist simply pass through now --- source/rendering/StarFontTextureGroup.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/rendering/StarFontTextureGroup.cpp') 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()) { - if (error->exception) { + if (auto string = error->cause.ptr()) { + if (!string->empty()) { + Logger::error("Error parsing font directives: {}", *string); + string->clear(); + } + } else if (auto& exception = error->cause.get()) { try - { std::rethrow_exception(error->exception); } + { std::rethrow_exception(error->cause.get()); } 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]); -- cgit v1.2.3