aboutsummaryrefslogtreecommitdiff
path: root/sixel.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-03-07 14:44:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-03-11 16:32:58 +0000
commit751ccf53162db0daf1f0318e421da31e337041e7 (patch)
tree067bf60d0989249caff1ec1f06ede68066ac7e02 /sixel.c
parentsixel: decgri: avoid load inside for-loop (diff)
sixel: add: increase data pointer instead of offset
Same ‘add’ instruction to increase the offset, but simpler ‘mov’ instruction when writing the pixel data.
Diffstat (limited to 'sixel.c')
-rw-r--r--sixel.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sixel.c b/sixel.c
index 10aa1f94..4f03143d 100644
--- a/sixel.c
+++ b/sixel.c
@@ -1004,13 +1004,13 @@ sixel_add(struct terminal *term, uint32_t color, uint8_t sixel)
xassert(term->sixel.pos.row < term->sixel.image.height);
size_t ofs = term->sixel.row_byte_ofs + term->sixel.pos.col;
- uint32_t *data = term->sixel.image.data;
+ uint32_t *data = &term->sixel.image.data[ofs];
int max_non_empty_row = 0;
- for (int i = 0; i < 6; i++, sixel >>= 1, ofs += width) {
+ for (int i = 0; i < 6; i++, sixel >>= 1, data += width) {
if (sixel & 1) {
- data[ofs] = color;
max_non_empty_row = i;
+ *data = color;
}
}