update damaged glyphs behind a kitty opaque cell #1704

This commit is contained in:
nick black 2021-06-28 19:52:21 -04:00 committed by Nick Black
parent 7aea2147d4
commit d06eb772b4
2 changed files with 41 additions and 14 deletions

View File

@ -159,6 +159,7 @@ paint_sprixel(ncplane* p, struct crender* rvec, int starty, int startx,
if(state == SPRIXCELL_ANNIHILATED || state == SPRIXCELL_ANNIHILATED_TRANS){
//fprintf(stderr, "REBUILDING AT %d/%d\n", y, x);
sprite_rebuild(nc, s, y, x);
//fprintf(stderr, "damaging due to rebuild [%s] %d/%d\n", nccell_extended_gcluster(crender->p, &crender->c), absy, absx);
}
}
}
@ -326,7 +327,7 @@ paint(ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
// side of a wide glyph (nor the null codepoint).
if( (targc->gcluster = vis->gcluster) ){ // index copy only
if(crender->sprixel && crender->sprixel->invalidated == SPRIXEL_HIDE){
//fprintf(stderr, "damaged due to hide\n");
//fprintf(stderr, "damaged due to hide %d/%d\n", y, x);
crender->s.damaged = 1;
}
crender->s.blittedquads = cell_blittedquadrants(vis);
@ -413,12 +414,16 @@ postpaint_cell(nccell* lastframe, int dimx, struct crender* crender,
//fprintf(stderr, "damaging due to cmp [%s] %d %d\n", nccell_extended_gcluster(crender->p, &crender->c), y, *x);
if(crender->sprixel){
sprixcell_e state = sprixel_state(crender->sprixel, y, *x);
if(!crender->s.p_beats_sprixel && state != SPRIXCELL_OPAQUE_KITTY && state != SPRIXCELL_OPAQUE_SIXEL){
//fprintf(stderr, "damaged due to opaque\n");
//fprintf(stderr, "state under candidate sprixel: %d %d/%d\n", state, y, *x);
// we don't need to change it when under an opaque Sixel cell, because
// that's always printed on top. we need to change it under kitty until
// we start using the animation protocol to do cuts without redraws FIXME.
if(!crender->s.p_beats_sprixel && state != SPRIXCELL_OPAQUE_SIXEL){
//fprintf(stderr, "damaged due to opaque %d/%d\n", y, *x);
crender->s.damaged = 1;
}
}else{
//fprintf(stderr, "damaged due to opaque else %d %d\n", y, *x);
//fprintf(stderr, "damaged due to opaque else %d/%d\n", y, *x);
crender->s.damaged = 1;
}
assert(!nccell_wide_right_p(targc));
@ -434,7 +439,7 @@ postpaint_cell(nccell* lastframe, int dimx, struct crender* crender,
targc->channels = crender[-i].c.channels;
targc->stylemask = crender[-i].c.stylemask;
if(cellcmp_and_dupfar(pool, prevcell, crender->p, targc) > 0){
//fprintf(stderr, "damaging due to cmp2\n");
//fprintf(stderr, "damaging due to cmp2 %d/%d\n", y, *x);
crender->s.damaged = 1;
}
}

View File

@ -18,6 +18,16 @@ across_row(struct notcurses* nc, int y, struct ncplane* n, struct ncplane* t,
return 0;
}
static int
across_bmap(struct notcurses* nc, struct ncplane* n, struct ncplane* t, const struct timespec* ds){
for(int y = 0 ; y < ncplane_dim_y(n) - 1 ; ++y){
if(across_row(nc, y, n, t, ds)){
return -1;
}
}
return 0;
}
// we should see the 1x1 white cell move across the face of the sprixel, hiding
// that cell of the sprixel, but leaving all others as they were. there ought
// be no flicker.
@ -55,21 +65,33 @@ handle(struct notcurses* nc, const char* fn){
ncplane_set_base(t, " ", 0, channels);
notcurses_render(nc);
clock_nanosleep(CLOCK_MONOTONIC, 0, &ds, NULL);
// move said cell through the sprixel
for(int y = 0 ; y < ncplane_dim_y(n) - 1 ; ++y){
if(across_row(nc, y, n, t, &ds)){
ncplane_destroy(n);
ncvisual_destroy(ncv);
return -1;
}
// move said 1x1 cell through the sprixel
if(across_bmap(nc, n, t, &ds)){
ncplane_destroy(n);
ncvisual_destroy(ncv);
return -1;
}
// now make it big and throw it over the bottom
if(ncplane_resize_simple(t, 6, ncplane_dim_x(n))){
// now do a 1x2 over the entirety
if(ncplane_resize_simple(t, 1, 2)){
ncplane_destroy(t);
ncplane_destroy(n);
ncvisual_destroy(ncv);
return -1;
}
if(across_bmap(nc, n, t, &ds)){
ncplane_destroy(n);
ncvisual_destroy(ncv);
return -1;
}
// now make it 6x1 and throw it over the bottom
if(ncplane_resize_simple(t, 6, 1)){
ncplane_destroy(t);
ncplane_destroy(n);
ncvisual_destroy(ncv);
return -1;
}
if(ncplane_move_yx(t, ncplane_dim_y(n) - ncplane_dim_y(t), 0)){
ncplane_destroy(t);
ncplane_destroy(n);
ncvisual_destroy(ncv);
return -1;