From 6e55be1557104184eb8eaa33ce7d5fd33fa1bdb5 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 18 Jul 2019 10:33:58 +0200 Subject: render: cache generated glyphs for regular ASCII characters To avoid having to re-generate glyphs, cache the glyphs. For now, we only cache ASCII characters, as this allows us to lookup the cache by simply indexing with the character (into a 256-entry array). --- main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 18673401..6db76da5 100644 --- a/main.c +++ b/main.c @@ -795,6 +795,8 @@ out: for (size_t i = 0; i < sizeof(term.fonts) / sizeof(term.fonts[0]); i++) { if (term.fonts[i].font != NULL) cairo_scaled_font_destroy(term.fonts[i].font); + for (size_t j = 0; j < 256; j++) + free(term.fonts[i].glyph_cache[j].glyphs); } if (term.ptmx != -1) -- cgit v1.3