sprixel_state: deal with margins #1561

pull/1567/head
nick black 4 years ago
parent bc123fbba8
commit b3c91ca4dd
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -993,11 +993,11 @@ sprixel_state(const sprixel* s, int y, int x){
const ncplane* stdn = notcurses_stdplane_const(ncplane_notcurses_const(s->n));
int localy = y - (s->n->absy - stdn->absy);
int localx = x - (s->n->absx - stdn->absx);
//fprintf(stderr, "TAM %d at %d/%d (%d/%d)\n", s->n->tacache[localy * s->dimx + localx], localy, localx, y, x);
assert(localy >= 0);
assert(localy < s->dimy);
assert(localx >= 0);
assert(localx < s->dimx);
//fprintf(stderr, "TAM %d at %d/%d (%d/%d)\n", s->n->tacache[localy * s->dimx + localx], localy, localx, y, x);
return s->n->tacache[localy * s->dimx + localx];
}

@ -381,8 +381,10 @@ int kitty_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
for(int xx = s->movedfromx ; xx < s->movedfromx + s->dimx && xx < p->dimx ; ++xx){
struct crender *r = &p->crender[yy * p->dimx + xx];
if(s->n){
const ncplane* stdn = notcurses_stdplane_const(nc);
//fprintf(stderr, "CHECKING %d/%d\n", yy - s->movedfromy, xx - s->movedfromx);
sprixcell_e state = sprixel_state(s, yy, xx);
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){
//fprintf(stderr, "DAMAGING %d/%d!\n", yy, xx);
r->s.damaged = 1;

@ -1022,8 +1022,8 @@ rasterize_core(notcurses* nc, const ncpile* p, FILE* out, unsigned phase){
// this is used to invalidate the sprixel in the first text round,
// which is only necessary for sixel, not kitty.
if(rvec[damageidx].sprixel
&& sprixel_state(rvec[damageidx].sprixel, y, x) != SPRIXCELL_TRANSPARENT
&& sprixel_state(rvec[damageidx].sprixel, y, x) != SPRIXCELL_ANNIHILATED
&& sprixel_state(rvec[damageidx].sprixel, y - nc->stdplane->absy, x - nc->stdplane->absx) != SPRIXCELL_TRANSPARENT
&& sprixel_state(rvec[damageidx].sprixel, y - nc->stdplane->absy, x - nc->stdplane->absx) != SPRIXCELL_ANNIHILATED
&& !rvec[damageidx].s.p_beats_sprixel
&& !sprixel_kitty_p(&nc->tcache)){
//fprintf(stderr, "INVALIDATING at %d/%d (%u)\n", y, x, rvec[damageidx].s.p_beats_sprixel);

Loading…
Cancel
Save