[sprixel] void* for auxvector

pull/2292/head
nick black 3 years ago
parent c2fca2392b
commit b544364ab4
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -727,7 +727,7 @@ sprite_rebuild(const notcurses* nc, sprixel* s, int ycell, int xcell){
if(s->n->tam[idx].state == SPRIXCELL_ANNIHILATED_TRANS){
s->n->tam[idx].state = SPRIXCELL_TRANSPARENT;
}else if(s->n->tam[idx].state == SPRIXCELL_ANNIHILATED){
uint8_t* auxvec = s->n->tam[idx].auxvector;
uint8_t* auxvec = (uint8_t*)s->n->tam[idx].auxvector;
assert(auxvec);
// sets the new state itself
ret = nc->tcache.pixel_rebuild(s, ycell, xcell, auxvec);

@ -347,8 +347,8 @@ kitty_anim_auxvec(int dimy, int dimx, int posy, int posx,
}
}
}
((uint8_t*)a)[slen - 1] = 0; // reset blitsource ownership
}
((uint8_t*)a)[slen - 1] = 0; // reset blitsource ownership
return a;
}
@ -849,12 +849,12 @@ write_kitty_data(fbuf* f, int linesize, int leny, int lenx, int cols,
// out, to present a glyph "atop" it). we will continue to mark it
// transparent, but we need to update the auxiliary vector.
const int vyx = (y % cdimy) * cdimx + (x % cdimx);
tam[tyx].auxvector[vyx] = ncpixel_a(source[e]);
((uint8_t*)tam[tyx].auxvector)[vyx] = ncpixel_a(source[e]);
wipe[e] = 1;
}else if(level == NCPIXEL_KITTY_SELFREF){
selfref_annihilated = true;
}else{
tam[tyx].auxvector[s->cellpxx * s->cellpxy * 4] = 1;
((uint8_t*)tam[tyx].auxvector)[s->cellpxx * s->cellpxy * 4] = 1;
wipe[e] = 1;
}
if(rgba_trans_p(source[e], transcolor)){
@ -862,16 +862,16 @@ write_kitty_data(fbuf* f, int linesize, int leny, int lenx, int cols,
if(x % cdimx == 0 && y % cdimy == 0){
tam[tyx].state = SPRIXCELL_ANNIHILATED_TRANS;
if(level == NCPIXEL_KITTY_SELFREF){
*tam[tyx].auxvector = SPRIXCELL_TRANSPARENT;
*(sprixcell_e*)tam[tyx].auxvector = SPRIXCELL_TRANSPARENT;
}
}else if(level == NCPIXEL_KITTY_SELFREF && tam[tyx].state == SPRIXCELL_ANNIHILATED_TRANS){
*tam[tyx].auxvector = SPRIXCELL_MIXED_KITTY;
*(sprixcell_e*)tam[tyx].auxvector = SPRIXCELL_MIXED_KITTY;
}
}else{
if(x % cdimx == 0 && y % cdimy == 0 && level == NCPIXEL_KITTY_SELFREF){
*tam[tyx].auxvector = SPRIXCELL_OPAQUE_KITTY;
}else if(level == NCPIXEL_KITTY_SELFREF && *tam[tyx].auxvector == SPRIXCELL_TRANSPARENT){
*tam[tyx].auxvector = SPRIXCELL_MIXED_KITTY;
*(sprixcell_e*)tam[tyx].auxvector = SPRIXCELL_OPAQUE_KITTY;
}else if(level == NCPIXEL_KITTY_SELFREF && *(sprixcell_e*)tam[tyx].auxvector == SPRIXCELL_TRANSPARENT){
*(sprixcell_e*)tam[tyx].auxvector = SPRIXCELL_MIXED_KITTY;
}
tam[tyx].state = SPRIXCELL_ANNIHILATED;
}

@ -60,7 +60,7 @@ int fbcon_blit(struct ncplane* n, int linesize, const void* data,
}
dst[3] = 0;
const int vyx = (l % cdimy) * cdimx + (c % cdimx);
n->tam[tyx].auxvector[vyx] = src[3];
((uint8_t*)n->tam[tyx].auxvector)[vyx] = src[3];
}else{
if(rgba_trans_p(*(uint32_t*)src, transcolor)){
ncpixel_set_a((uint32_t*)src, 0); // in case it was transcolor

@ -123,7 +123,7 @@ typedef enum {
// reconstruction of annihilated cells, valid only for SPRIXCELL_ANNIHILATED.
typedef struct tament {
sprixcell_e state;
uint8_t* auxvector; // palette entries for sixel, alphas for kitty
void* auxvector; // palette entries for sixel, alphas for kitty
} tament;
// a sprixel represents a bitmap, using whatever local protocol is available.

Loading…
Cancel
Save