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

pull/1640/head
nick black 3 years ago
parent 8f6879ab7f
commit e0e747837e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -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, sprixcell_e state = sprixel_state(s, yy - s->movedfromy + s->n->absy - stdn->absy,
xx - s->movedfromx + s->n->absx - stdn->absx); xx - s->movedfromx + s->n->absx - stdn->absx);
if(state == SPRIXCELL_OPAQUE_KITTY){ if(state == SPRIXCELL_OPAQUE_KITTY){
//fprintf(stderr, "DAMAGED 1\n");
r->s.damaged = 1; r->s.damaged = 1;
}else if(s->invalidated == SPRIXEL_MOVED){ }else if(s->invalidated == SPRIXEL_MOVED){
// ideally, we wouldn't damage our annihilated sprixcells, but if // ideally, we wouldn't damage our annihilated sprixcells, but if
// we're being annihilated only during this cycle, we need to go // we're being annihilated only during this cycle, we need to go
// ahead and damage it. // ahead and damage it.
//fprintf(stderr, "DAMAGED 2\n");
r->s.damaged = 1; r->s.damaged = 1;
} }
}else{ }else{
//fprintf(stderr, "DAMAGED 3\n"); // need this to damage cells underneath a sprixel we're removing
//r->s.damaged = 1; r->s.damaged = 1;
} }
} }
} }

@ -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 yy = starty ; yy < starty + s->dimy && yy < p->dimy ; ++yy){
for(int xx = startx ; xx < startx + s->dimx && xx < p->dimx ; ++xx){ for(int xx = startx ; xx < startx + s->dimx && xx < p->dimx ; ++xx){
struct crender *r = &p->crender[yy * p->dimx + xx]; struct crender *r = &p->crender[yy * p->dimx + xx];
// FIXME this probably overdoes it -- look at kitty_destroy()
if(!r->sprixel){ if(!r->sprixel){
r->s.damaged = 1; r->s.damaged = 1;
} }

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

Loading…
Cancel
Save