[kitty] clean all non-opaque on delete #1527

pull/1567/head
nick black 3 years ago
parent c7f1c32f7f
commit 17bde9ffa4
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -915,7 +915,6 @@ plane_debug(const ncplane* n, bool details){
// can just print directly over the bitmap.
int sprite_kitty_cell_wipe(const notcurses* nc, sprixel* s, int y, int x);
int sixel_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell);
int sprite_destroy(const struct notcurses* nc, const struct ncpile* p, FILE* out, sprixel* s);
void sprixel_free(sprixel* s);
void sprixel_hide(sprixel* s);
int sprite_draw(const notcurses* n, const ncpile *p, sprixel* s, FILE* out);
@ -929,9 +928,9 @@ 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);
int sixel_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s);
int sprite_kitty_annihilate(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s);
int sprite_kitty_init(int fd);
int sprite_sixel_init(int fd);
int kitty_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s);
int kitty_init(int fd);
int sixel_init(int fd);
int sprite_init(const notcurses* nc);
int kitty_shutdown(int fd);
int sixel_shutdown(int fd);
@ -945,6 +944,11 @@ static inline bool sprixel_kitty_p(const tinfo* t){
return t->pixel_shutdown == kitty_shutdown;
}
static inline int
sprite_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
return nc->tcache.pixel_destroy(nc, p, out, s);
}
static inline void
clamp_to_sixelmax(const tinfo* t, int* y, int* x){
if(t->sixel_maxy && *y > t->sixel_maxy){

@ -369,8 +369,8 @@ int kitty_blit(ncplane* n, int linesize, const void* data,
}
// removes the kitty bitmap graphic identified by s->id, and damages those
// cells which were SPRIXCEL_OPAQUE
int sprite_kitty_annihilate(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
// cells which weren't SPRIXCEL_OPAQUE
int kitty_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
(void)p;
(void)nc;
if(fprintf(out, "\e_Ga=d,d=i,i=%d\e\\", s->id) < 0){
@ -382,7 +382,8 @@ int sprite_kitty_annihilate(const notcurses* nc, const ncpile* p, FILE* out, spr
struct crender *r = &p->crender[yy * p->dimx + xx];
if(s->n){
//fprintf(stderr, "CHECKING %d/%d\n", yy - s->movedfromy, xx - s->movedfromx);
if(s->n->tacache[(yy - s->movedfromy) * s->dimx + (xx - s->movedfromx)] == SPRIXCELL_OPAQUE){
sprixcell_e state = sprixel_state(s, yy, xx);
if(state != SPRIXCELL_OPAQUE){
//fprintf(stderr, "DAMAGING %d/%d!\n", yy, xx);
r->s.damaged = 1;
}
@ -405,7 +406,7 @@ int kitty_draw(const notcurses* nc, const ncpile* p, sprixel* s, FILE* out){
}
// clears all kitty bitmaps
int sprite_kitty_init(int fd){
int kitty_init(int fd){
return tty_emit("\e_Ga=d\e\\", fd);
}

@ -545,7 +545,7 @@ int sixel_draw(const notcurses* n, const ncpile* p, sprixel* s, FILE* out){
return 0;
}
int sprite_sixel_init(int fd){
int sixel_init(int fd){
// \e[?8452: DECSDM private "sixel scrolling" mode keeps the sixel from
// scrolling, but puts it at the current cursor location (as opposed to
// the upper left corner of the screen).

@ -17,7 +17,7 @@ void sprixel_free(sprixel* s){
sprixel* sprixel_recycle(ncplane* n){
assert(n->sprite);
const notcurses* nc = ncplane_notcurses_const(n);
if(nc->tcache.pixel_destroy == sprite_kitty_annihilate){
if(nc->tcache.pixel_destroy == kitty_delete){
sprixel* hides = n->sprite;
int dimy = hides->dimy;
int dimx = hides->dimx;
@ -148,10 +148,3 @@ int sprite_init(const notcurses* nc){
}
return nc->tcache.pixel_init(nc->ttyfd);
}
int sprite_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
if(!nc->tcache.pixel_destroy){
return 0;
}
return nc->tcache.pixel_destroy(nc, p, out, s);
}

@ -62,8 +62,8 @@ apply_term_heuristics(tinfo* ti, const char* termname){
ti->pixel_query_done = true;
ti->bitmap_supported = true;
ti->pixel_cell_wipe = sprite_kitty_cell_wipe;
ti->pixel_destroy = sprite_kitty_annihilate;
ti->pixel_init = sprite_kitty_init;
ti->pixel_destroy = kitty_delete;
ti->pixel_init = kitty_init;
ti->pixel_draw = kitty_draw;
ti->pixel_shutdown = kitty_shutdown;
set_pixel_blitter(kitty_blit);
@ -334,7 +334,7 @@ static void
setup_sixel(tinfo* ti){
ti->bitmap_supported = true;
ti->color_registers = 256; // assumed default [shrug]
ti->pixel_init = sprite_sixel_init;
ti->pixel_init = sixel_init;
ti->pixel_draw = sixel_draw;
ti->sixel_maxx = 4096; // whee!
ti->sixel_maxy = 4096;

Loading…
Cancel
Save