From 85ef9df586dfca22d16d04c9777dc38ff896223a Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 30 Jul 2019 18:03:03 +0200 Subject: render: add a 'clean' bit to each cell; only render cells that aren't clean This patch takes a bit from the foreground color value in a cell (todo: split up foreground/background into bitfields with a separate field for 'foreground/background' has been set), and only re-renders cells that aren't marked as clean. Note: we use a 'clean' bit rather than a 'dirty' bit to make it easy to erase cells - we can (keep doing) do that by simply memsetting a cell range to 0. --- grid.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'grid.c') diff --git a/grid.c b/grid.c index 47e09065..2ff82bd7 100644 --- a/grid.c +++ b/grid.c @@ -29,6 +29,8 @@ grid_row_alloc(int cols) { struct row *row = malloc(sizeof(*row)); row->cells = calloc(cols, sizeof(row->cells[0])); + for (size_t c = 0; c < cols; c++) + row->cells[c].attrs.clean = 1; row->dirty = false; /* TODO: parameter? */ return row; } -- cgit v1.3