From 15263b2a311c32e7c7d8efe460a0f86e605928aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi
Date: Thu, 31 Dec 2020 13:12:38 +0200
Subject: [PATCH 1/1] Text: Clear glyph cache when it fills up
We can use a smaller glyph cache if we clear it when it fills up. Even a large cache would eventually fill up, so clearing is a good strategy anyway. Clears occur still rather infrequently.
src/ui/text.c | 2 +-
src/ui/window.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ui/text.c b/src/ui/text.c
index ac2766a3..615cb176 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -369,7 +369,7 @@ static void initCache_Text_(iText *d) {
init_Array(&d->cacheRows, sizeof(iCacheRow));
const int textSize = d->contentFontSize * fontSize_UI;
iAssert(textSize > 0);
d->cacheSize = mul_I2(cacheDims, init1_I2(iMax(textSize, fontSize_UI)));
SDL_RendererInfo renderInfo;
SDL_GetRendererInfo(d->render, &renderInfo);
diff --git a/src/ui/window.c b/src/ui/window.c
index e1bb1c0b..6d358576 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -960,7 +960,7 @@ void draw_Window(iWindow *d) {
#if 0
/* Text cache debugging. */ {
SDL_Texture *cache = glyphCache_Text();
SDL_Rect rect = { d->root->rect.size.x - 640, 0, 640, 5 * 640 };
SDL_Rect rect = { d->root->rect.size.x - 640, 0, 640, 2.5 * 640 };
SDL_SetRenderDrawColor(d->render, 0, 0, 0, 255);
SDL_RenderFillRect(d->render, &rect);
SDL_RenderCopy(d->render, glyphCache_Text(), NULL, &rect);
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).