mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-12 05:34:01 -04:00
sixel: calculate alpha when updating the palette
Calculate color, with alpha, when updating the palette instead of every time we *use* the palette.
This commit is contained in:
parent
869743060e
commit
f143efb999
1 changed files with 6 additions and 9 deletions
15
sixel.c
15
sixel.c
|
|
@ -980,11 +980,7 @@ decsixel(struct terminal *term, uint8_t c)
|
||||||
case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v':
|
case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v':
|
||||||
case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}':
|
case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}':
|
||||||
case '~':
|
case '~':
|
||||||
sixel_add(
|
sixel_add(term, term->sixel.palette[term->sixel.color_idx], c - 63);
|
||||||
term,
|
|
||||||
color_with_alpha(
|
|
||||||
term, term->sixel.palette[term->sixel.color_idx]),
|
|
||||||
c - 63);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ' ':
|
case ' ':
|
||||||
|
|
@ -1064,8 +1060,7 @@ decgri(struct terminal *term, uint8_t c)
|
||||||
case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}':
|
case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}':
|
||||||
case '~': {
|
case '~': {
|
||||||
//LOG_DBG("repeating '%c' %u times", c, term->sixel.param);
|
//LOG_DBG("repeating '%c' %u times", c, term->sixel.param);
|
||||||
uint32_t color = color_with_alpha(
|
uint32_t color = term->sixel.palette[term->sixel.color_idx];
|
||||||
term, term->sixel.palette[term->sixel.color_idx]);
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < term->sixel.param; i++)
|
for (unsigned i = 0; i < term->sixel.param; i++)
|
||||||
sixel_add(term, color, c - 63);
|
sixel_add(term, color, c - 63);
|
||||||
|
|
@ -1131,7 +1126,8 @@ decgci(struct terminal *term, uint8_t c)
|
||||||
LOG_DBG("setting palette #%d = HLS %hhu/%hhu/%hhu (0x%06x)",
|
LOG_DBG("setting palette #%d = HLS %hhu/%hhu/%hhu (0x%06x)",
|
||||||
term->sixel.color_idx, hue, lum, sat, rgb);
|
term->sixel.color_idx, hue, lum, sat, rgb);
|
||||||
|
|
||||||
term->sixel.palette[term->sixel.color_idx] = rgb;
|
term->sixel.palette[term->sixel.color_idx] =
|
||||||
|
color_with_alpha(term, rgb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1143,7 +1139,8 @@ decgci(struct terminal *term, uint8_t c)
|
||||||
LOG_DBG("setting palette #%d = RGB %hhu/%hhu/%hhu",
|
LOG_DBG("setting palette #%d = RGB %hhu/%hhu/%hhu",
|
||||||
term->sixel.color_idx, r, g, b);
|
term->sixel.color_idx, r, g, b);
|
||||||
|
|
||||||
term->sixel.palette[term->sixel.color_idx] = r << 16 | g << 8 | b;
|
term->sixel.palette[term->sixel.color_idx] =
|
||||||
|
color_with_alpha(term, r << 16 | g << 8 | b);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue