diff --git a/src/lib/direct.c b/src/lib/direct.c index ac73a5248..fa9464c74 100644 --- a/src/lib/direct.c +++ b/src/lib/direct.c @@ -547,7 +547,7 @@ ncdirect_render_visual(ncdirect* n, ncvisual* ncv, ncblitter_e blitfxn, bargs.u.pixel.colorregs = n->tcache.color_registers; int cols = lenx / bargs.u.pixel.celldimx + !!(lenx % bargs.u.pixel.celldimx); int rows = leny / bargs.u.pixel.celldimy + !!(leny % bargs.u.pixel.celldimy); - if((bargs.u.pixel.spx = sprixel_alloc(ncdv, ncv, rows, cols, 0, 0)) == NULL){ + if((bargs.u.pixel.spx = sprixel_alloc(ncdv, ncv, rows, cols)) == NULL){ free_plane(ncdv); return NULL; } diff --git a/src/lib/internal.h b/src/lib/internal.h index 6274fed32..b3864ba9a 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -111,8 +111,7 @@ typedef enum { // // when a sprixel is removed from the rendering pile, in Sixel all cells it // covered must be marked damaged, so that they are rendered, obliterating -// the bitmap. in Kitty the bitmap can simply be deleted, except for those -// cells which were SPRIXCELL_OPAQUE (they must be damaged). +// the bitmap. in Kitty the bitmap can simply be deleted. // // when a sprixel is moved, its TAM must be updated. OPAQUE, MIXED, and // TRANSPARENT cells retain their entries. ANNIHILATED cells remain @@ -923,8 +922,7 @@ 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); // dimy and dimx are cell geometry, not pixel. takes ownership of s on success. -sprixel* sprixel_alloc(ncplane* n, struct ncvisual* ncv, int dimy, int dimx, - int placey, int placex); +sprixel* sprixel_alloc(ncplane* n, struct ncvisual* ncv, int dimy, int dimx); sprixel* sprixel_recycle(ncplane* n, struct ncvisual* ncv); int sprixel_load(sprixel* spx, char* s, int bytes, int placey, int placex, int pixy, int pixx, int parse_start); diff --git a/src/lib/kitty.c b/src/lib/kitty.c index 7ea870005..327fed923 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -209,7 +209,7 @@ int sprite_kitty_cell_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell if(thisrow == 0){ //fprintf(stderr, "CLEARED ROW, TARGY: %d\n", targy - 1); if(--targy == 0){ - //s->invalidated = SPRIXEL_INVALIDATED; + s->invalidated = SPRIXEL_INVALIDATED; return 0; } thisrow = targx; @@ -367,27 +367,13 @@ int kitty_blit(ncplane* n, int linesize, const void* data, return 1; } -// removes the kitty bitmap graphic identified by s->id, and damages those -// cells which were SPRIXCEL_OPAQUE +// removes the kitty bitmap graphic identified by s->id int sprite_kitty_annihilate(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){ return 0; } -//fprintf(stderr, "MOVED FROM: %d/%d\n", s->movedfromy, s->movedfromx); - for(int yy = s->movedfromy ; yy < s->movedfromy + s->dimy && yy < p->dimy ; ++yy){ - for(int xx = s->movedfromx ; xx < s->movedfromx + s->dimx && xx < p->dimx ; ++xx){ - 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){ -//fprintf(stderr, "DAMAGING %d/%d!\n", yy, xx); - r->s.damaged = 1; - } - } - } - } return 0; } diff --git a/src/lib/render.c b/src/lib/render.c index c6321f940..024bf85dd 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -866,10 +866,7 @@ clean_sprixels(notcurses* nc, const ncpile* p, FILE* out){ ret = -1; } }else if(s->invalidated == SPRIXEL_MOVED || s->invalidated == SPRIXEL_INVALIDATED){ - // FIXME clean this up, don't use sprite_draw, etc. - if(s->invalidated == SPRIXEL_MOVED){ - sprite_destroy(nc, p, out, s); - } + // FIXME clean this up, don't use sprite_draw, don't always move, etc. int y, x; ncplane_yx(s->n, &y, &x); y += s->y; diff --git a/src/lib/sprite.c b/src/lib/sprite.c index 6df0d047e..4558cb55b 100644 --- a/src/lib/sprite.c +++ b/src/lib/sprite.c @@ -24,10 +24,8 @@ sprixel* sprixel_recycle(ncplane* n, ncvisual* ncv){ assert(hides); int dimy = hides->dimy; int dimx = hides->dimx; - int y = hides->y; - int x = hides->x; sprixel_hide(hides); - return sprixel_alloc(n, ncv, dimy, dimx, y, x); + return sprixel_alloc(n, ncv, dimy, dimx); } return n->sprite; } @@ -37,7 +35,6 @@ sprixel* sprixel_recycle(ncplane* n, ncvisual* ncv){ void sprixel_movefrom(sprixel* s, int y, int x){ if(s->invalidated != SPRIXEL_HIDE){ if(s->invalidated != SPRIXEL_MOVED){ -//fprintf(stderr, "SETTING TO MOVE: %d/%d was: %d\n", y, x, s->invalidated); s->invalidated = SPRIXEL_MOVED; s->movedfromy = y; s->movedfromx = x; @@ -86,8 +83,7 @@ sprixel* sprixel_by_id(const notcurses* nc, uint32_t id){ return NULL; } -sprixel* sprixel_alloc(ncplane* n, ncvisual* ncv, int dimy, int dimx, - int placey, int placex){ +sprixel* sprixel_alloc(ncplane* n, ncvisual* ncv, int dimy, int dimx){ sprixel* ret = malloc(sizeof(sprixel)); if(ret){ memset(ret, 0, sizeof(*ret)); @@ -95,8 +91,6 @@ sprixel* sprixel_alloc(ncplane* n, ncvisual* ncv, int dimy, int dimx, ret->ncv = ncv; ret->dimy = dimy; ret->dimx = dimx; - ret->y = placey; - ret->x = placex; ret->id = ++sprixelid_nonce; //fprintf(stderr, "LOOKING AT %p (p->n = %p)\n", ret, ret->n); if(ncplane_pile(ret->n)){ diff --git a/src/lib/visual.c b/src/lib/visual.c index 960496f6b..cb5b4ff4e 100644 --- a/src/lib/visual.c +++ b/src/lib/visual.c @@ -694,7 +694,7 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits if(n->sprite){ sprixel_hide(n->sprite); } - if((ncv->spx = sprixel_alloc(n, ncv, rows, cols, placey, placex)) == NULL){ + if((ncv->spx = sprixel_alloc(n, ncv, rows, cols)) == NULL){ goto err; } }else{