mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-17 05:33:52 -04:00
glyph-cache: generate at startup, never update while rendering
This commit is contained in:
parent
332f1c6a21
commit
6e69cf9562
2 changed files with 38 additions and 20 deletions
14
render.c
14
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue