account for margins in sixel_state() #1561

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

@ -910,16 +910,17 @@ plane_debug(const ncplane* n, bool details){
}
}
// cell coordinates *within the sprixel*, not absolute
int sprite_wipe(const notcurses* nc, sprixel* s, int y, int x);
int sixel_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell);
// nulls out a cell from a kitty bitmap via changing the alpha value
// throughout to 0. the same trick doesn't work on sixel, but there we
// can just print directly over the bitmap.
int sprite_kitty_cell_wipe(const notcurses* nc, sprixel* s, int y, int x);
int kitty_wipe(const notcurses* nc, sprixel* s, int y, int x);
// cell coordinates *within the sprixel*, not absolute
int sprite_wipe(const notcurses* nc, sprixel* s, int y, int x);
int sixel_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell);
void sprixel_free(sprixel* s);
void sprixel_hide(sprixel* s);
int sprite_draw(const notcurses* n, const ncpile *p, sprixel* s, FILE* out);
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);
@ -988,9 +989,10 @@ scrub_tam_boundaries(sprixcell_e* tam, int leny, int lenx, int cdimy, int cdimx)
// get the TAM entry for these (absolute) coordinates
static inline sprixcell_e
sprixel_state(sprixel* s, int y, int x){
int localy = y - s->n->absy;
int localx = x - s->n->absx;
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);
assert(localy >= 0);
assert(localy < s->dimy);
assert(localx >= 0);

@ -153,7 +153,7 @@ kitty_null(char* triplet, int skip, int max, int pleft){
}
#define RGBA_MAXLEN 768 // 768 base64-encoded pixels in 4096 bytes
int sprite_kitty_cell_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell){
int kitty_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell){
if(s->n->tacache[s->dimx * ycell + xcell] == SPRIXCELL_ANNIHILATED){
//fprintf(stderr, "CACHED WIPE %d %d/%d\n", s->id, ycell, xcell);
return 0; // already annihilated, needn't draw glyph in kitty

@ -61,7 +61,7 @@ apply_term_heuristics(tinfo* ti, const char* termname){
ti->quadrants = true;
ti->pixel_query_done = true;
ti->bitmap_supported = true;
ti->pixel_cell_wipe = sprite_kitty_cell_wipe;
ti->pixel_cell_wipe = kitty_wipe;
ti->pixel_destroy = kitty_delete;
ti->pixel_init = kitty_init;
ti->pixel_draw = kitty_draw;

Loading…
Cancel
Save