From 6a509328faa676770d6fa38c9f1b2f97e20ba26d Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 18 Apr 2021 10:35:08 -0400 Subject: [PATCH] sprite_wipe_cell -> sprite_wipe --- src/lib/internal.h | 4 +++- src/lib/render.c | 7 ++++--- src/lib/sprite.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/internal.h b/src/lib/internal.h index 53e0bf0aa..803895e25 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -914,6 +914,9 @@ plane_debug(const ncplane* n, bool details){ // 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); + +// 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); @@ -926,7 +929,6 @@ sprixel* sprixel_recycle(ncplane* n); // takes ownership of s on success. 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 kitty_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s); int kitty_init(int fd); diff --git a/src/lib/render.c b/src/lib/render.c index c6321f940..8613dc625 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -134,6 +134,7 @@ highcontrast(uint32_t bchannel){ return conrgb; } +// wants coordinates within the sprixel, not absolute static void paint_sprixel(const ncplane* p, const nccell* vis, struct crender* crender, int y, int x){ @@ -145,8 +146,8 @@ paint_sprixel(const ncplane* p, const nccell* vis, struct crender* crender, if(crender->p || crender->s.bgblends){ // if sprite_wipe_cell() fails, we presumably do not have the // ability to wipe, and must reprint the character - if(sprite_wipe_cell(nc, p->sprite, y, x)){ -//fprintf(stderr, "damaging due to wipe %d/%d\n", y, x); + if(sprite_wipe(nc, p->sprite, y, x)){ +//fprintf(stderr, "damaging due to wipe [%s] %d/%d\n", nccell_extended_gcluster(crender->p, &crender->c), y, x); crender->s.damaged = 1; } crender->s.p_beats_sprixel = 1; @@ -385,7 +386,7 @@ postpaint_cell(nccell* lastframe, int dimx, struct crender* crender, lock_in_highcontrast(targc, crender); nccell* prevcell = &lastframe[fbcellidx(y, dimx, *x)]; if(cellcmp_and_dupfar(pool, prevcell, crender->p, targc) > 0){ -//fprintf(stderr, "damaging due to cmp\n"); +//fprintf(stderr, "damaging due to cmp [%s] %d %d\n", nccell_extended_gcluster(crender->p, &crender->c), y, *x); if(crender->sprixel){ if(!crender->s.p_beats_sprixel && sprixel_state(crender->sprixel, y, *x) != SPRIXCELL_OPAQUE){ crender->s.damaged = 1; diff --git a/src/lib/sprite.c b/src/lib/sprite.c index c40562ca8..3ad6fe274 100644 --- a/src/lib/sprite.c +++ b/src/lib/sprite.c @@ -123,7 +123,7 @@ int sprixel_load(sprixel* spx, char* s, int bytes, int placey, int placex, // returns 1 if already annihilated, 0 if we successfully annihilated the cell, // or -1 if we could not annihilate the cell (i.e. we're sixel). -int sprite_wipe_cell(const notcurses* nc, sprixel* s, int ycell, int xcell){ +int sprite_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell){ if(s->invalidated == SPRIXEL_HIDE){ // no need to do work if we're killing it return 0; }