[render] end kitty flicker #1493

pull/1499/head
nick black 3 years ago committed by Nick Black
parent 631697e9e2
commit 021fc052fc

@ -812,6 +812,7 @@ int kitty_draw(const notcurses* n, const ncpile *p, sprixel* s, FILE* out);
int sixel_draw(const notcurses* n, const ncpile *p, sprixel* s, FILE* out);
// dimy and dimx are cell geometry, not pixel. takes ownership of s on success.
sprixel* sprixel_alloc(ncplane* n, int dimy, int dimx);
sprixel* sprixel_recycle(ncplane* n);
int sprixel_load(sprixel* spx, char* s, int bytes, int placey, int placex,
int pixy, int pixx, int parse_start);
int sprite_wipe_cell(const notcurses* nc, sprixel* s, int y, int x);

@ -1984,9 +1984,11 @@ void ncplane_yx(const ncplane* n, int* y, int* x){
}
void ncplane_erase(ncplane* n){
/*if(n->sprite){
sprixel_hide(n->sprite);
}*/
if(n->sprite){
// FIXME ideally we'd clear out the sprixel here, necessary for multiframe
// media with transparency, but it leads to intense flicker in sixel...=[
return;
}
// we must preserve the background, but a pure cell_duplicate() would be
// wiped out by the egcpool_dump(). do a duplication (to get the stylemask
// and channels), and then reload.

@ -1085,19 +1085,19 @@ notcurses_rasterize_inner(notcurses* nc, const ncpile* p, FILE* out){
// we explicitly move the cursor at the beginning of each output line, so no
// need to home it expliticly.
update_palette(nc, out);
fprintf(stderr, "pile %p ymax: %d xmax: %d\n", p, p->dimy + nc->stdplane->absy, p->dimx + nc->stdplane->absx);
//fprintf(stderr, "pile %p ymax: %d xmax: %d\n", p, p->dimy + nc->stdplane->absy, p->dimx + nc->stdplane->absx);
if(clean_sprixels(nc, p, out) < 0){
return -1;
}
fprintf(stderr, "RASTERIZE CORE\n");
//fprintf(stderr, "RASTERIZE CORE\n");
if(rasterize_core(nc, p, out)){
return -1;
}
fprintf(stderr, "RASTERIZE SPRIXELS\n");
//fprintf(stderr, "RASTERIZE SPRIXELS\n");
if(rasterize_sprixels(nc, p, out) < 0){
return -1;
}
fprintf(stderr, "RASTERIZE CORE\n");
//fprintf(stderr, "RASTERIZE CORE\n");
if(rasterize_core(nc, p, out)){
return -1;
}

@ -10,6 +10,17 @@ void sprixel_free(sprixel* s){
}
}
sprixel* sprixel_recycle(ncplane* n){
const notcurses* nc = ncplane_notcurses(n);
if(nc->tcache.pixel_destroy == sprite_kitty_annihilate){
int dimy = n->sprite->dimy;
int dimx = n->sprite->dimx;
sprixel_hide(n->sprite);
return sprixel_alloc(n, dimy, dimx);
}
return n->sprite;
}
// store the original (absolute) coordinates from which we moved, so that
// we can invalidate them in sprite_draw().
void sprixel_movefrom(sprixel* s, int y, int x){
@ -52,7 +63,6 @@ sprixel* sprixel_by_id(const notcurses* nc, uint32_t id){
sprixel* sprixel_alloc(ncplane* n, int dimy, int dimx){
sprixel* ret = malloc(sizeof(sprixel));
if(ret){
fprintf(stderr, "LOADING UP %p with %p\n", ret, n);
memset(ret, 0, sizeof(*ret));
ret->n = n;
ret->dimy = dimy;

@ -608,6 +608,8 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
if((ncv->spx = sprixel_alloc(n, rows, cols)) == NULL){
goto err;
}
}else{
ncv->spx = sprixel_recycle(n);
}
bargs.u.pixel.spx = ncv->spx;
if(ncvisual_blit(ncv, disprows, dispcols, n, bset, disprows, dispcols, &bargs)){

Loading…
Cancel
Save