mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-13 04:27:47 -05:00
grid: attributes now track whether we've set a foreground/background color
This means we don't have to explicitly set the foreground/background to the grid's default colors whenever we reset/clear a cell, and we can instead simply memset() the entire cell to 0. This also means the renderer has to get the default color when rendering a cell without a foreground/background color set.
This commit is contained in:
parent
97420f13d8
commit
3a97fce6d0
4 changed files with 25 additions and 21 deletions
8
grid.c
8
grid.c
|
|
@ -187,14 +187,6 @@ grid_erase(struct grid *grid, int start, int end)
|
|||
{
|
||||
assert(end >= start);
|
||||
memset(&grid->cells[start], 0, (end - start) * sizeof(grid->cells[0]));
|
||||
|
||||
for (int i = start; i < end; i++) {
|
||||
struct cell *cell = &grid->cells[i];
|
||||
|
||||
cell->attrs.foreground = grid->foreground;
|
||||
cell->attrs.background = grid->background;
|
||||
}
|
||||
|
||||
grid_damage_erase(grid, start, end - start);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue