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).
This commit is contained in:
Daniel Eklöf 2019-07-18 10:33:58 +02:00
parent c9803a2018
commit 6e55be1557
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 47 additions and 8 deletions

2
main.c
View file

@ -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)