mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
fbcon_wipe: preserve auxvec
This commit is contained in:
parent
1113f7dd35
commit
cd635316d9
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user