grid: grid_memset() -> grid_memclear()

This commit is contained in:
Daniel Eklöf 2019-07-07 17:10:15 +02:00
parent abff0e205e
commit 48528419c4
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 7 additions and 8 deletions

2
csi.c
View file

@ -630,7 +630,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
tll_free(term->alt.damage); tll_free(term->alt.damage);
tll_free(term->alt.scroll_damage); tll_free(term->alt.scroll_damage);
grid_memset(term->grid, 0, 0, term->rows * term->cols); grid_memclear(term->grid, 0, term->rows * term->cols);
term_damage_erase(term, 0, term->rows * term->cols); term_damage_erase(term, 0, term->rows * term->cols);
} }
break; break;

4
grid.c
View file

@ -27,7 +27,7 @@ grid_get_range(struct grid *grid, int start, int *length)
} }
void void
grid_memset(struct grid *grid, int start, int c, int length) grid_memclear(struct grid *grid, int start, int length)
{ {
int left = length; int left = length;
while (left > 0) { while (left > 0) {
@ -37,7 +37,7 @@ grid_memset(struct grid *grid, int start, int c, int length)
assert(count > 0); assert(count > 0);
assert(count <= left); assert(count <= left);
memset(cells, c, count * sizeof(cells[0])); memset(cells, 0, count * sizeof(cells[0]));
left -= count; left -= count;
start += count; start += count;

2
grid.h
View file

@ -4,5 +4,5 @@
#include "terminal.h" #include "terminal.h"
struct cell *grid_get_range(struct grid *grid, int start, int *length); struct cell *grid_get_range(struct grid *grid, int start, int *length);
void grid_memset(struct grid *grid, int start, int c, int length); void grid_memclear(struct grid *grid, int start, int length);
void grid_memmove(struct grid *grid, int dst, int src, int length); void grid_memmove(struct grid *grid, int dst, int src, int length);

View file

@ -183,7 +183,7 @@ term_erase(struct terminal *term, int start, int end)
term_damage_update(term, start, end - start); term_damage_update(term, start, end - start);
} else { } else {
grid_memset(term->grid, start, 0, end - start); grid_memclear(term->grid, start, end - start);
term_damage_erase(term, start, end - start); term_damage_erase(term, start, end - start);
} }
} }
@ -293,10 +293,9 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows
term->grid->offset += rows * term->cols; term->grid->offset += rows * term->cols;
/* Clear scrolled-in lines */ /* Clear scrolled-in lines */
grid_memset( grid_memclear(
term->grid, term->grid,
max(0, region.end - rows) * term->cols, max(0, region.end - rows) * term->cols,
0,
min(rows, term->rows) * term->cols); min(rows, term->rows) * term->cols);
term_damage_scroll(term, DAMAGE_SCROLL, region, rows); term_damage_scroll(term, DAMAGE_SCROLL, region, rows);
@ -359,7 +358,7 @@ term_scroll_reverse_partial(struct terminal *term,
term->grid->offset -= rows * term->cols; term->grid->offset -= rows * term->cols;
grid_memset(term->grid, region.start * term->cols, 0, rows * term->cols); grid_memclear(term->grid, region.start * term->cols, rows * term->cols);
term_damage_scroll(term, DAMAGE_SCROLL_REVERSE, region, rows); term_damage_scroll(term, DAMAGE_SCROLL_REVERSE, region, rows);