mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-30 11:10:23 -04:00
cell: pack more efficiently and store glyph as a wchar
The 'attributes' struct is now 8 bytes and naturally packed (used to be 9 bytes, artificially packed). 'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes, artificially packed). Furthermore, the glyph is stored as a wchar instead of a char*. This makes it easier (faster) to do glyph lookup when rendering.
This commit is contained in:
parent
ab92abbd21
commit
4d7993b36f
9 changed files with 146 additions and 129 deletions
|
|
@ -163,11 +163,12 @@ erase_cell_range(struct terminal *term, struct row *row, int start, int end)
|
|||
assert(start < term->cols);
|
||||
assert(end < term->cols);
|
||||
|
||||
if (unlikely(term->vt.attrs.background >> 30)) {
|
||||
if (unlikely(term->vt.attrs.have_bg)) {
|
||||
for (int col = start; col <= end; col++) {
|
||||
row->cells[col].c[0] = '\0';
|
||||
row->cells[col].wc = 0;
|
||||
row->cells[col].attrs.clean = 0;
|
||||
row->cells[col].attrs.background = term->vt.attrs.background;
|
||||
row->cells[col].attrs.have_bg = 1;
|
||||
row->cells[col].attrs.bg = term->vt.attrs.bg;
|
||||
}
|
||||
} else {
|
||||
memset(&row->cells[start], 0, (end - start + 1) * sizeof(row->cells[0]));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue