mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-24 09:05:48 -04:00
sixel: finalize: use width/height from image, not row/col pos
This commit is contained in:
parent
a8dc61d0ff
commit
23d39e6f90
1 changed files with 4 additions and 10 deletions
14
sixel.c
14
sixel.c
|
|
@ -57,16 +57,11 @@ sixel_unhook(struct terminal *term)
|
||||||
free(term->sixel.palette);
|
free(term->sixel.palette);
|
||||||
term->sixel.palette = NULL;
|
term->sixel.palette = NULL;
|
||||||
|
|
||||||
if (term->sixel.pos.col > term->sixel.max_col)
|
|
||||||
term->sixel.max_col = term->sixel.pos.col;
|
|
||||||
term->sixel.pos.row++;
|
|
||||||
term->sixel.pos.col = 0;
|
|
||||||
|
|
||||||
struct sixel image = {
|
struct sixel image = {
|
||||||
.data = term->sixel.image.data,
|
.data = term->sixel.image.data,
|
||||||
.width = term->sixel.max_col,
|
.width = term->sixel.image.width,
|
||||||
.height = term->sixel.pos.row * 6,
|
.height = term->sixel.image.height,
|
||||||
.rows = (term->sixel.pos.row * 6 + term->cell_height - 1) / term->cell_height,
|
.rows = (term->sixel.image.height + term->cell_height - 1) / term->cell_height,
|
||||||
.pos = (struct coord){term->cursor.point.col, term->grid->offset + term->cursor.point.row},
|
.pos = (struct coord){term->cursor.point.col, term->grid->offset + term->cursor.point.row},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -93,8 +88,7 @@ sixel_unhook(struct terminal *term)
|
||||||
term->sixel.max_col = 0;
|
term->sixel.max_col = 0;
|
||||||
term->sixel.pos = (struct coord){0, 0};
|
term->sixel.pos = (struct coord){0, 0};
|
||||||
|
|
||||||
const size_t lines = (image.height + term->cell_height - 1) / term->cell_height;
|
for (size_t i = 0; i < image.rows; i++)
|
||||||
for (size_t i = 0; i < lines; i++)
|
|
||||||
term_linefeed(term);
|
term_linefeed(term);
|
||||||
term_formfeed(term);
|
term_formfeed(term);
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue