sixel: fix hls-to-rgb and color count issues (#185)
This fixes the following sixel issues: - The HLS to RGB color conversion is broken. Ref.d4ade1fe3c- Not enough color registers have been allocated for 1024 colors. Ref.97f93e8436
This commit is contained in:
parent
37bc089f1d
commit
490d2440da
3 changed files with 25 additions and 20 deletions
7
sixel.c
7
sixel.c
|
|
@ -100,9 +100,13 @@ set_default_color(sixel_image_t *image)
|
|||
image->palette[n++] = SIXEL_RGB(i * 11, i * 11, i * 11);
|
||||
}
|
||||
|
||||
/* sixels rarely use more than 256 colors and if they do, they use a custom
|
||||
* palette, so we don't need to initialize these colors */
|
||||
/*
|
||||
for (; n < DECSIXEL_PALETTE_MAX; n++) {
|
||||
image->palette[n] = SIXEL_RGB(255, 255, 255);
|
||||
}
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -610,11 +614,12 @@ sixel_parser_parse(sixel_state_t *st, const unsigned char *p, size_t len)
|
|||
st->param = 0;
|
||||
|
||||
if (st->nparams > 0) {
|
||||
st->color_index = 1 + st->params[0]; /* offset 1(background color) added */
|
||||
st->color_index = st->params[0];
|
||||
if (st->color_index < 0)
|
||||
st->color_index = 0;
|
||||
else if (st->color_index >= DECSIXEL_PALETTE_MAX)
|
||||
st->color_index = DECSIXEL_PALETTE_MAX - 1;
|
||||
st->color_index++; /* offset by 1 (background) */
|
||||
}
|
||||
|
||||
if (st->nparams > 4) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue