kitty: must damage cells underneath a sprixel when hiding #1562

This commit is contained in:
nick black 2021-05-08 17:13:59 -04:00
parent 8f6879ab7f
commit e0e747837e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 5 additions and 5 deletions

View File

@ -581,18 +581,16 @@ int kitty_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
sprixcell_e state = sprixel_state(s, yy - s->movedfromy + s->n->absy - stdn->absy,
xx - s->movedfromx + s->n->absx - stdn->absx);
if(state == SPRIXCELL_OPAQUE_KITTY){
//fprintf(stderr, "DAMAGED 1\n");
r->s.damaged = 1;
}else if(s->invalidated == SPRIXEL_MOVED){
// ideally, we wouldn't damage our annihilated sprixcells, but if
// we're being annihilated only during this cycle, we need to go
// ahead and damage it.
//fprintf(stderr, "DAMAGED 2\n");
r->s.damaged = 1;
}
}else{
//fprintf(stderr, "DAMAGED 3\n");
//r->s.damaged = 1;
// need this to damage cells underneath a sprixel we're removing
r->s.damaged = 1;
}
}
}

View File

@ -696,6 +696,7 @@ int sixel_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
for(int yy = starty ; yy < starty + s->dimy && yy < p->dimy ; ++yy){
for(int xx = startx ; xx < startx + s->dimx && xx < p->dimx ; ++xx){
struct crender *r = &p->crender[yy * p->dimx + xx];
// FIXME this probably overdoes it -- look at kitty_destroy()
if(!r->sprixel){
r->s.damaged = 1;
}

View File

@ -82,16 +82,17 @@ void sprixel_movefrom(sprixel* s, int y, int x){
void sprixel_hide(sprixel* s){
if(ncplane_pile(s->n) == NULL){ // ncdirect case; destroy now
//fprintf(stderr, "HIDING %d IMMEDIATELY\n", s->id);
sprixel_free(s);
return;
}
// otherwise, it'll be killed in the next rendering cycle.
// guard so that a double call doesn't drop core on /s->n->sprite
if(s->invalidated != SPRIXEL_HIDE){
//fprintf(stderr, "HIDING %d\n", s->id);
s->invalidated = SPRIXEL_HIDE;
s->movedfromy = ncplane_abs_y(s->n);
s->movedfromx = ncplane_abs_x(s->n);
// guard; might have already been replaced
if(s->n){
s->n->sprite = NULL;
s->n = NULL;