mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-02 01:40:13 -05:00
grid: add per-cell combining characters
The data is *not* added to the cell struct, since that one is too performance critical. Instead, the data is added as a separate array in the row struct. This allows our performance critical code paths that e.g. clear cells to perform as before.
This commit is contained in:
parent
69c3e74498
commit
b2c4115f3e
2 changed files with 11 additions and 1 deletions
6
grid.c
6
grid.c
|
|
@ -34,10 +34,13 @@ grid_row_alloc(int cols, bool initialize)
|
||||||
|
|
||||||
if (initialize) {
|
if (initialize) {
|
||||||
row->cells = calloc(cols, sizeof(row->cells[0]));
|
row->cells = calloc(cols, sizeof(row->cells[0]));
|
||||||
|
row->comb_chars = calloc(cols, sizeof(row->comb_chars[0]));
|
||||||
for (size_t c = 0; c < cols; c++)
|
for (size_t c = 0; c < cols; c++)
|
||||||
row->cells[c].attrs.clean = 1;
|
row->cells[c].attrs.clean = 1;
|
||||||
} else
|
} else {
|
||||||
row->cells = malloc(cols * sizeof(row->cells[0]));
|
row->cells = malloc(cols * sizeof(row->cells[0]));
|
||||||
|
row->comb_chars = malloc(cols * sizeof(row->comb_chars[0]));
|
||||||
|
}
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +51,7 @@ grid_row_free(struct row *row)
|
||||||
if (row == NULL)
|
if (row == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
free(row->comb_chars);
|
||||||
free(row->cells);
|
free(row->cells);
|
||||||
free(row);
|
free(row);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,10 +77,16 @@ struct damage {
|
||||||
int lines;
|
int lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct combining_chars {
|
||||||
|
uint8_t count;
|
||||||
|
wchar_t chars[5]; /* TODO: do we need this many? */
|
||||||
|
};
|
||||||
|
|
||||||
struct row {
|
struct row {
|
||||||
struct cell *cells;
|
struct cell *cells;
|
||||||
bool dirty;
|
bool dirty;
|
||||||
bool linebreak;
|
bool linebreak;
|
||||||
|
struct combining_chars *comb_chars;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sixel {
|
struct sixel {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue