From b544364ab4b22439d84ed56e098f3a798f577577 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 18 Oct 2021 19:11:51 -0400 Subject: [PATCH] [sprixel] void* for auxvector --- src/lib/internal.h | 2 +- src/lib/kitty.c | 16 ++++++++-------- src/lib/linux.c | 2 +- src/lib/sprite.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib/internal.h b/src/lib/internal.h index 2b0bc612b..1dea2cfdc 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -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); diff --git a/src/lib/kitty.c b/src/lib/kitty.c index 4dada6e1e..9f0988e00 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -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; } diff --git a/src/lib/linux.c b/src/lib/linux.c index aea28efa7..019a2f18a 100644 --- a/src/lib/linux.c +++ b/src/lib/linux.c @@ -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 diff --git a/src/lib/sprite.h b/src/lib/sprite.h index 598e7d999..7373fe4e6 100644 --- a/src/lib/sprite.h +++ b/src/lib/sprite.h @@ -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.