From 0202d60daec076ceac6722f4b0f11eef5fddcd5a Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Sun, 13 Mar 2022 07:30:46 +0200

Subject: [PATCH 1/1] Text: Don't allocate unused subpixel steps


src/ui/text.c | 50 +++++++++++++++++++++++++++++++++-----------------

1 file changed, 33 insertions(+), 17 deletions(-)

diff --git a/src/ui/text.c b/src/ui/text.c

index 4d445f53..95de986a 100644

--- a/src/ui/text.c

+++ b/src/ui/text.c

@@ -93,21 +93,35 @@ static const float contentScale_Text_ = 1.3f;

int gap_Text; /* cf. gap_UI in metrics.h */

int enableHalfPixelGlyphs_Text = iTrue; /* debug setting */

int enableKerning_Text = iTrue; /* looking up kern pairs is slow */

-int numOffsetSteps_Glyph = 4; /* subpixel offsets for glyphs */

-iLocalDef float offsetStep_Glyph_(void) {

-}

enum iGlyphFlag {

 rasterized0_GlyphFlag = iBit(1),    /* zero offset */

 rasterized1_GlyphFlag = iBit(2),    /* quarter pixel offset */

 rasterized2_GlyphFlag = iBit(3),    /* half-pixel offset */

 rasterized3_GlyphFlag = iBit(4),    /* three quarters offset */

};

+static int numOffsetSteps_Glyph_ = 4; /* subpixel offsets for glyphs */

+static int rasterizedAll_GlyphFlag_ = 0xf; /* updated with numOffsetSteps_Glyph */

+iLocalDef float offsetStep_Glyph_(void) {

+}

+static int makeRasterizedAll_GlyphFlag_(int n) {

+}

struct Impl_Glyph {

 iHashNode node;

 int       flags;

@@ -139,7 +153,7 @@ iLocalDef iBool isRasterized_Glyph_(const iGlyph *d, int hoff) {

}

iLocalDef iBool isFullyRasterized_Glyph_(const iGlyph *d) {

}

iLocalDef void setRasterized_Glyph_(iGlyph *d, int hoff) {

@@ -410,13 +424,15 @@ static void initCache_Text_(iText *d) {

 init_Array(&d->cacheRows, sizeof(iCacheRow));

 const int textSize = d->contentFontSize * fontSize_UI;

 iAssert(textSize > 0);

-#if !defined (NDEBUG)

+#if !defined(NDEBUG)

#endif

 SDL_RendererInfo renderInfo;

 SDL_GetRendererInfo(d->render, &renderInfo);

 if (renderInfo.max_texture_height > 0 && d->cacheSize.y > renderInfo.max_texture_height) {

@@ -709,7 +725,7 @@ static iGlyph *glyphByIndex_Font_(iFont *d, uint32_t glyphIndex) {

     glyph->font = d;

     /* New glyphs are always allocated at least. This reserves a position in the cache

        and updates the glyph metrics. */

         allocate_Font_(d, glyph, offsetIndex);

     }

     insert_Hash(&d->table->glyphs, &glyph->node);

@@ -1267,8 +1283,8 @@ static void cacheGlyphs_Font_(iFont *d, const uint32_t *glyphIndices, size_t num

                 SDL_SetSurfaceBlendMode(buf, SDL_BLENDMODE_NONE);

                 SDL_SetSurfacePalette(buf, glyphPalette_());

             }

                 surfaces[si] = !isRasterized_Glyph_(glyph, si)

                                    ? rasterizeGlyph_Font_(glyph->font,

                                                           index_Glyph_(glyph),

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.12/patch/0202d60daec076ceac6722f4b0f11eef5fddcd5a.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
49.680291 milliseconds
Gemini-to-HTML Time
1.649019 milliseconds

This content has been proxied by September (ba2dc).