fbcon_wipe: preserve auxvec

This commit is contained in:
nick black 2021-07-23 05:43:15 -04:00
parent 1113f7dd35
commit cd635316d9
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 6 additions and 3 deletions

View File

@ -724,6 +724,7 @@ sprite_commit(tinfo* ti, FILE* out, sprixel* s, unsigned forcescroll){
static inline int
sprite_rebuild(const notcurses* nc, sprixel* s, int ycell, int xcell){
logdebug("rebuilding %d %d/%d\n", s->id, ycell, xcell);
const int idx = s->dimx * ycell + xcell;
int ret = 0;
// special case the transition back to SPRIXCELL_TRANSPARENT; this can be
@ -731,9 +732,9 @@ sprite_rebuild(const notcurses* nc, sprixel* s, int ycell, int xcell){
if(s->n->tam[idx].state == SPRIXCELL_ANNIHILATED_TRANS){
s->n->tam[idx].state = SPRIXCELL_TRANSPARENT;
}else if(s->n->tam[idx].state == SPRIXCELL_ANNIHILATED){
// sets the new state itself
uint8_t* auxvec = s->n->tam[idx].auxvector;
assert(auxvec);
// sets the new state itself
ret = nc->tcache.pixel_rebuild(s, ycell, xcell, auxvec);
if(ret > 0){
free(auxvec);

View File

@ -9,7 +9,6 @@ int fbcon_wipe(sprixel* s, int ycell, int xcell){
char* glyph = s->glyph;
for(int y = 0 ; y < s->cellpxy ; ++y){
size_t offset = (ycell * s->dimx + xcell) * 4;
// FIXME need preserve auxvec
for(int x = 0 ; x < s->cellpxx ; ++x){
const int vyx = (y % s->cellpxy) * s->cellpxx + (x % s->cellpxx);
auxvec[vyx] = glyph[offset + 3];
@ -17,6 +16,7 @@ int fbcon_wipe(sprixel* s, int ycell, int xcell){
offset += 4;
}
}
s->n->tam[s->dimx * ycell + xcell].auxvector = auxvec;
return 0;
}

View File

@ -193,12 +193,13 @@ int sprite_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell){
//fprintf(stderr, "CACHED WIPE %d %d/%d\n", s->id, ycell, xcell);
return 0;
}
//fprintf(stderr, "ANNIHILATING %p %d\n", s->n->tam, idx);
logdebug("wiping %p %d %d/%d\n", s->n->tam, idx, ycell, xcell);
int r = nc->tcache.pixel_wipe(s, ycell, xcell);
//fprintf(stderr, "WIPED %d %d/%d ret=%d\n", s->id, ycell, xcell, r);
// mark the cell as annihilated whether we actually scrubbed it or not,
// so that we use this fact should we move to another frame
s->n->tam[idx].state = SPRIXCELL_ANNIHILATED;
assert(s->n->tam[idx].auxvector);
return r;
}

View File

@ -117,6 +117,7 @@ setup_fbcon_bitmaps(tinfo* ti, int fd){
ti->pixel_wipe = fbcon_wipe;
ti->pixel_draw = fbcon_draw;
ti->pixel_scrub = fbcon_scrub;
ti->pixel_trans_auxvec = kitty_trans_auxvec;
set_pixel_blitter(fbcon_blit);
sprite_init(ti, fd);
}