sixel_blit: correct number of bands #1378

This commit is contained in:
nick black 2021-02-28 02:07:08 -05:00
parent 796e2fe1eb
commit 381b34019a
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -869,24 +869,24 @@ sixel_blit(ncplane* nc, int placey, int placex, int linesize,
unsigned bitsused = 0; // once 63, we're done
int colorreg = 1; // leave 0 as background
bool printed = false;
for(int sy = y ; sy < dimy && sy < y + 6 ; ++sy){
for(int sy = visy ; sy < dimy && sy < visy + 6 ; ++sy){
const uint32_t* rgb = (const uint32_t*)(data + (linesize * sy) + (visx * 4));
if(ffmpeg_trans_p(ncpixel_a(*rgb))){
continue;
}
if(bitsused & (1u << (sy - y))){
if(bitsused & (1u << (sy - visy))){
continue;
}
unsigned char comps[3];
break_sixel_comps(comps, *rgb);
unsigned thesebits = 1u << (sy - y);
for(int ty = sy + 1 ; ty < dimy && ty < y + 6 ; ++ty){
unsigned thesebits = 1u << (sy - visy);
for(int ty = sy + 1 ; ty < dimy && ty < visy + 6 ; ++ty){
const uint32_t* trgb = (const uint32_t*)(data + (linesize * ty) + (visx * 4));
if(!ffmpeg_trans_p(ncpixel_a(*trgb))){
unsigned char candcomps[3];
break_sixel_comps(candcomps, *trgb);
if(memcmp(comps, candcomps, sizeof(comps)) == 0){
thesebits |= (1u << (ty - y));
thesebits |= (1u << (ty - visy));
}
}
}