diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-09-05 09:08:13 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-09-05 09:08:13 +0000 |
| commit | 47c32d5913044912f5e0974ab6554de1f2a62b3b (patch) | |
| tree | 7d048ec3c6924fc63ed70f44006259c8e4caefbe /sixel.c | |
| parent | sixel: calculate default bg once, in init (diff) | |
sixel: avoid looking up color from palette for each sixel
Instead, do the palette lookup when we receive the DECGCI (i.e. when
the palette entry is selected), and store the actual color value in
our sixel struct.
Diffstat (limited to 'sixel.c')
| -rw-r--r-- | sixel.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1272,8 +1272,6 @@ sixel_add(struct terminal *term, int col, int width, uint32_t color, uint8_t six static void sixel_add_many(struct terminal *term, uint8_t c, unsigned count) { - uint32_t color = term->sixel.palette[term->sixel.color_idx]; - int col = term->sixel.pos.col; int width = term->sixel.image.width; @@ -1283,6 +1281,7 @@ sixel_add_many(struct terminal *term, uint8_t c, unsigned count) return; } + uint32_t color = term->sixel.color; for (unsigned i = 0; i < count; i++, col++) sixel_add(term, col, width, color, c); @@ -1509,7 +1508,8 @@ decgci(struct terminal *term, uint8_t c) break; } } - } + } else + term->sixel.color = term->sixel.palette[term->sixel.color_idx]; term->sixel.state = SIXEL_DECSIXEL; sixel_put(term, c); |
