free auxvectors at ncplane free time, not sixel hide time #1440

pull/1610/head
nick black 3 years ago committed by Nick Black
parent 6ad7fcc7a9
commit 9c472a5d5e

@ -617,7 +617,7 @@ typedef struct notcurses {
unsigned stdio_blocking_save; // was stdio blocking at entry? restore on stop.
} notcurses;
typedef struct {
typedef struct blitterargs {
int begy; // upper left start within visual
int begx;
int placey; // placement within ncplane
@ -1002,6 +1002,7 @@ sprite_rebuild(const notcurses* nc, sprixel* s, int ycell, int xcell){
s->n->tam[s->dimx * ycell + xcell].state = SPRIXCELL_TRANSPARENT;
}else if(s->n->tam[s->dimx * ycell + xcell].state == SPRIXCELL_ANNIHILATED){
uint8_t* auxvec = s->n->tam[s->dimx * ycell + xcell].auxvector;
assert(auxvec);
// sets the new state itself
ret = nc->tcache.pixel_rebuild(s, ycell, xcell, auxvec);
}

@ -205,7 +205,7 @@ kitty_null(char* triplet, int skip, int max, int pleft, uint8_t* auxvec){
static inline int
kitty_restore(char* triplet, int skip, int max, int pleft,
const uint8_t* auxvec, sprixcell_e* state){
//fprintf(stderr, "SKIP/MAX/PLEFT %d/%d/%d\n", skip, max, pleft);
//fprintf(stderr, "SKIP/MAX/PLEFT %d/%d/%d auxvec %p\n", skip, max, pleft, auxvec);
if(pleft > 3){
pleft = 3;
}

@ -269,6 +269,14 @@ void free_plane(ncplane* p){
if(p->sprite){
sprixel_hide(p->sprite);
}
if(p->tam){
for(int y = 0 ; y < p->leny ; ++y){
for(int x = 0 ; x < p->lenx ; ++x){
free(p->tam[y * p->lenx + x].auxvector);
p->tam[y * p->lenx + x].auxvector = NULL;
}
}
}
free(p->tam);
egcpool_dump(&p->pool);
free(p->name);

@ -86,12 +86,6 @@ void sprixel_hide(sprixel* s){
s->movedfromy = ncplane_abs_y(s->n);
s->movedfromx = ncplane_abs_x(s->n);
if(s->n){
for(int y = 0 ; y < s->dimy ; ++y){
for(int x = 0 ; x < s->dimx ; ++x){
free(s->n->tam[y * s->dimx + x].auxvector);
s->n->tam[y * s->dimx + x].auxvector = NULL;
}
}
s->n->sprite = NULL;
s->n = NULL;
}

Loading…
Cancel
Save