From 6e69cf9562b116585c1eceddc86b5b0f5589129b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 18 Jul 2019 13:03:21 +0200 Subject: glyph-cache: generate at startup, never update while rendering --- render.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 1de2e4c4..5b3c2956 100644 --- a/render.c +++ b/render.c @@ -190,8 +190,8 @@ render_cell(struct terminal *term, struct buffer *buf, const struct cell *cell, if (likely(entry != NULL && entry->glyphs != NULL)) { /* Copy cached glyph(s) and upate position */ + memcpy(gseq.g, entry->glyphs, entry->count * sizeof(gseq.g[0])); for (size_t i = 0; i < entry->count; i++) { - gseq.g[i] = entry->glyphs[i]; gseq.g[i].x += x; gseq.g[i].y += y; } @@ -206,18 +206,6 @@ render_cell(struct terminal *term, struct buffer *buf, const struct cell *cell, if (status != CAIRO_STATUS_SUCCESS) return; - - if (entry != NULL) { - assert(entry->glyphs == NULL); - entry->glyphs = malloc(new_glyphs * sizeof(entry->glyphs[0])); - entry->count = new_glyphs; - - for (size_t i = 0; i < new_glyphs; i++) { - entry->glyphs[i] = gseq.g[i]; - entry->glyphs[i].x -= x; - entry->glyphs[i].y -= y; - } - } } gseq.g += new_glyphs; -- cgit v1.3