Use a 'damage' list to communicate what needs to be updated

Instead of having each cell in the grid track it's own dirtiness, grid
operations now append "damage" to a list.

This list is consumed every time we render the grid.

This allows us to special case some operations, like erase (and in the
future, scroll).
This commit is contained in:
Daniel Eklöf 2019-06-19 14:17:43 +02:00
parent 10765687db
commit 304f15d696
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 269 additions and 89 deletions

6
vt.c
View file

@ -200,8 +200,7 @@ action(struct terminal *term, enum action action, uint8_t c)
}
struct cell *cell = &term->grid.cells[term->grid.linear_cursor];
cell->dirty = true;
grid_damage_update(&term->grid, term->grid.linear_cursor, 1);
if (term->vt.utf8.idx > 0) {
//LOG_DBG("print: UTF8: %.*s", (int)term->vt.utf8.idx, term->vt.utf8.data);
@ -209,7 +208,7 @@ action(struct terminal *term, enum action action, uint8_t c)
cell->c[term->vt.utf8.idx] = '\0';
memset(&term->vt.utf8, 0, sizeof(term->vt.utf8));
} else {
LOG_DBG("print: ASCII: %c", c);
//LOG_DBG("print: ASCII: %c", c);
cell->c[0] = c;
cell->c[1] = '\0';
}
@ -221,7 +220,6 @@ action(struct terminal *term, enum action action, uint8_t c)
else
term->grid.print_needs_wrap = true;
term->grid.dirty = true;
break;
}