notcurses_resize(): kill unnecessary memset()

This commit is contained in:
nick black 2020-05-07 01:25:32 -04:00
parent fa865d1971
commit 94e42809fe
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 5 additions and 7 deletions

View File

@ -82,9 +82,11 @@ int highcontrast_demo(struct notcurses* nc){
cell_load_simple(n, &c, motto[out % strlen(motto)]);
cell_set_bg(&c, scrcolors[out % totcells]);
if(ncplane_putc_yx(n, (out + dimx) / dimx, out % dimx, &c) < 0){
free(scrcolors);
goto err;
}
}
free(scrcolors);
// each iteration, "draw the background in" one cell from the top left and
// bottom right.
int offset = 0;
@ -110,6 +112,5 @@ int highcontrast_demo(struct notcurses* nc){
err:
cell_release(n, &c);
free(scrcolors);
return ret;
}

View File

@ -536,11 +536,11 @@ int ncreel_redraw(ncreel* nr){
if(nr->last_traveled_direction >= 0){
otherend = draw_previous_tablets(nr, otherend);
otherend = draw_following_tablets(nr, otherend);
otherend = draw_previous_tablets(nr, otherend);
draw_previous_tablets(nr, otherend);
}else{
otherend = draw_following_tablets(nr, otherend);
otherend = draw_previous_tablets(nr, otherend);
otherend = draw_following_tablets(nr, otherend);
draw_following_tablets(nr, otherend);
}
//fprintf(stderr, "DONE ARRANGING\n");
return 0;

View File

@ -35,15 +35,12 @@ int notcurses_resize(notcurses* n, int* restrict rows, int* restrict cols){
const size_t size = sizeof(*n->lastframe) * (n->lfdimy * n->lfdimx);
cell* fb = realloc(n->lastframe, size);
if(fb == NULL){
abort(); // FIXME
return -1;
}
n->lastframe = fb;
// FIXME more memset()tery than we need, both wasting work and wrecking
// damage detection for the upcoming render
memset(n->lastframe, 0, size);
n->lastframe = fb;
memset(fb, 0, size);
egcpool_dump(&n->pool);
}
if(*rows == oldrows && *cols == oldcols){
@ -445,6 +442,7 @@ int ncplane_mergedown(ncplane* restrict src, ncplane* restrict dst){
postpaint(tmpfb, rendfb, dimy, dimx, rvec, &dst->pool);
free(dst->fb);
dst->fb = rendfb;
free(tmpfb);
free(rvec);
return 0;
}

View File

@ -53,7 +53,6 @@ int main(void){
y -= up;
int newy;
if(ncdirect_cursor_yx(n, &newy, NULL)){
ret = -1;
return EXIT_FAILURE;
}
if(newy != y){