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). --- terminal.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index d17d2128..8bfc3918 100644 --- a/terminal.h +++ b/terminal.h @@ -202,6 +202,11 @@ struct primary { uint32_t serial; }; +struct glyph_cache { + cairo_glyph_t *glyphs; + int count; +}; + struct font { cairo_scaled_font_t *font; struct { @@ -212,6 +217,8 @@ struct font { double position; double thickness; } strikeout; + + struct glyph_cache glyph_cache[256]; }; struct terminal { -- cgit v1.3