mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-12 05:34:01 -04:00
sixel: avoid multiplication inside the inner sixel emitter loop
This commit is contained in:
parent
6658740982
commit
7603ae5dc3
1 changed files with 6 additions and 6 deletions
12
sixel.c
12
sixel.c
|
|
@ -921,13 +921,13 @@ sixel_add(struct terminal *term, uint32_t color, uint8_t sixel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t ofs = term->sixel.pos.row * term->sixel.image.width;
|
||||||
|
ofs += term->sixel.pos.col;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++, sixel >>= 1) {
|
for (int i = 0; i < 6; i++, sixel >>= 1) {
|
||||||
if (sixel & 1) {
|
if (sixel & 1)
|
||||||
size_t pixel_row = term->sixel.pos.row + i;
|
term->sixel.image.data[ofs] = color_with_alpha(term, color);
|
||||||
size_t stride = term->sixel.image.width;
|
ofs += term->sixel.image.width;
|
||||||
size_t idx = pixel_row * stride + term->sixel.pos.col;
|
|
||||||
term->sixel.image.data[idx] = color_with_alpha(term, color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xassert(sixel == 0);
|
xassert(sixel == 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue