[sixel] don't damage on delete just because new sprixel is mixed #1553

pull/1567/head
nick black 3 years ago
parent 7d61457b37
commit 74744abc89
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -153,7 +153,6 @@ typedef struct sprixel {
// both the plane and visual can die before the sprixel does. they are
// responsible in such a case for NULLing out this link themselves.
struct ncplane* n; // associated ncplane
struct ncvisual* ncv; // associated ncvisual
sprixel_e invalidated;// sprixel invalidation state
struct sprixel* next;
int y, x;

@ -516,7 +516,7 @@ int sixel_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
for(int yy = s->movedfromy ; yy < s->movedfromy + s->dimy && yy < p->dimy ; ++yy){
for(int xx = s->movedfromx ; xx < s->movedfromx + s->dimx && xx < p->dimx ; ++xx){
struct crender *r = &p->crender[yy * p->dimx + xx];
if(!r->sprixel || sprixel_state(r->sprixel, yy, xx) != SPRIXCELL_OPAQUE){
if(!r->sprixel){
r->s.damaged = 1;
}
}
@ -527,7 +527,14 @@ int sixel_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
int sixel_draw(const notcurses* n, const ncpile* p, sprixel* s, FILE* out){
(void)n;
if(s->invalidated == SPRIXEL_MOVED){
sixel_delete(n, p, out, s);
for(int yy = s->movedfromy ; yy < s->movedfromy + s->dimy && yy < p->dimy ; ++yy){
for(int xx = s->movedfromx ; xx < s->movedfromx + s->dimx && xx < p->dimx ; ++xx){
struct crender *r = &p->crender[yy * p->dimx + xx];
if(!r->sprixel || sprixel_state(r->sprixel, yy, xx) != SPRIXCELL_OPAQUE){
r->s.damaged = 1;
}
}
}
s->invalidated = SPRIXEL_INVALIDATED;
}else{
if(fwrite(s->glyph, s->glyphlen, 1, out) != 1){

Loading…
Cancel
Save