From d5fbd2001b0ad3591a7f969dfd75c809ab55b40e Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 30 Jun 2023 04:34:10 +1000 Subject: RenderPrimitive micro-optimizations --- source/rendering/StarTextPainter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/rendering/StarTextPainter.cpp') diff --git a/source/rendering/StarTextPainter.cpp b/source/rendering/StarTextPainter.cpp index 631000e..ca69fb1 100644 --- a/source/rendering/StarTextPainter.cpp +++ b/source/rendering/StarTextPainter.cpp @@ -539,6 +539,7 @@ RectF TextPainter::doRenderLine(StringView text, TextPositioning const& position RectF TextPainter::doRenderGlyph(String::Char c, TextPositioning const& position, bool reallyRender) { if (m_nonRenderedCharacters.find(String(c)) != NPos) return RectF(); + m_fontTextureGroup.switchFont(m_renderSettings.font); int width = glyphWidth(c); // Offset left by width if right anchored. @@ -581,8 +582,8 @@ void TextPainter::renderGlyph(String::Char c, Vec2F const& screenPos, unsigned f return; const FontTextureGroup::GlyphTexture& glyphTexture = m_fontTextureGroup.glyphTexture(c, fontSize, processingDirectives); - Vec2F offset = glyphTexture.processingOffset * (scale * 0.5f); //Kae: Re-center the glyph if the image scale was changed by the directives (it is positioned from the bottom left) - m_renderer->render(renderTexturedRect(glyphTexture.texture, Vec2F(screenPos) + offset, scale, color, 0.0f)); + Vec2F offset = glyphTexture.processingOffset * (scale * 0.5f); + m_renderer->immediatePrimitives().emplace_back(std::in_place_type_t(), glyphTexture.texture, screenPos + offset, scale, color, 0.0f); } } -- cgit v1.2.3