mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-15 22:05:24 -05:00
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.
This commit is contained in:
parent
c531795b83
commit
85ef9df586
7 changed files with 52 additions and 33 deletions
11
render.c
11
render.c
|
|
@ -174,8 +174,13 @@ arm_blink_timer(struct terminal *term)
|
|||
|
||||
static void
|
||||
render_cell(struct terminal *term, struct buffer *buf, size_t buf_idx,
|
||||
const struct cell *cell, int col, int row, bool has_cursor)
|
||||
struct cell *cell, int col, int row, bool has_cursor)
|
||||
{
|
||||
if (cell->attrs.clean)
|
||||
return;
|
||||
|
||||
cell->attrs.clean = 1;
|
||||
|
||||
cairo_t *cr = buf->cairo[buf_idx];
|
||||
double width = term->cell_width;
|
||||
double height = term->cell_height;
|
||||
|
|
@ -185,10 +190,10 @@ render_cell(struct terminal *term, struct buffer *buf, size_t buf_idx,
|
|||
bool block_cursor = has_cursor && term->cursor_style == CURSOR_BLOCK;
|
||||
bool is_selected = coord_is_selected(term, col, row);
|
||||
|
||||
uint32_t _fg = cell->attrs.foreground >> 31
|
||||
uint32_t _fg = cell->attrs.foreground >> 30
|
||||
? cell->attrs.foreground
|
||||
: !term->reverse ? term->colors.fg : term->colors.bg;
|
||||
uint32_t _bg = cell->attrs.background >> 31
|
||||
uint32_t _bg = cell->attrs.background >> 30
|
||||
? cell->attrs.background
|
||||
: !term->reverse ? term->colors.bg : term->colors.fg;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue