mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
sixel: stop cropping images to the last non-transparent row
This commit is contained in:
parent
d6d143e2a6
commit
774570ec41
3 changed files with 1 additions and 22 deletions
|
|
@ -76,6 +76,7 @@
|
|||
typically result in the last row not being visible, unless a newline
|
||||
is explicitly added.
|
||||
* Default sixel aspect ratio is now 2:1 instead of 1:1.
|
||||
* Sixel images are no longer cropped to the last non-transparent row.
|
||||
|
||||
|
||||
[1371]: https://codeberg.org/dnkl/foot/pulls/1371
|
||||
|
|
|
|||
21
sixel.c
21
sixel.c
|
|
@ -53,7 +53,6 @@ sixel_init(struct terminal *term, int p1, int p2, int p3)
|
|||
|
||||
term->sixel.state = SIXEL_DECSIXEL;
|
||||
term->sixel.pos = (struct coord){0, 0};
|
||||
term->sixel.max_non_empty_row_no = -1;
|
||||
term->sixel.row_byte_ofs = 0;
|
||||
term->sixel.color_idx = 0;
|
||||
term->sixel.pan = pan;
|
||||
|
|
@ -952,13 +951,6 @@ sixel_reflow(struct terminal *term)
|
|||
void
|
||||
sixel_unhook(struct terminal *term)
|
||||
{
|
||||
if (term->sixel.image.height > term->sixel.max_non_empty_row_no + 1) {
|
||||
LOG_DBG(
|
||||
"last row only partially filled, reducing image height: %d -> %d",
|
||||
term->sixel.image.height, term->sixel.max_non_empty_row_no + 1);
|
||||
term->sixel.image.height = term->sixel.max_non_empty_row_no + 1;
|
||||
}
|
||||
|
||||
int pixel_row_idx = 0;
|
||||
int pixel_rows_left = term->sixel.image.height;
|
||||
const int stride = term->sixel.image.width * sizeof(uint32_t);
|
||||
|
|
@ -1298,21 +1290,13 @@ sixel_add(struct terminal *term, int col, int width, uint32_t color, uint8_t six
|
|||
size_t ofs = term->sixel.row_byte_ofs + col;
|
||||
uint32_t *data = &term->sixel.image.data[ofs];
|
||||
|
||||
int max_non_empty_row = -1;
|
||||
int row = term->sixel.pos.row;
|
||||
|
||||
for (int i = 0; i < 6 * term->sixel.pan; i++, sixel >>= 1, data += width) {
|
||||
if (sixel & 1) {
|
||||
*data = color;
|
||||
max_non_empty_row = row + i;
|
||||
}
|
||||
}
|
||||
|
||||
xassert(sixel == 0);
|
||||
|
||||
term->sixel.max_non_empty_row_no = max(
|
||||
term->sixel.max_non_empty_row_no,
|
||||
max_non_empty_row);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1448,11 +1432,6 @@ decgra(struct terminal *term, uint8_t c)
|
|||
ph <= term->sixel.max_height && pv <= term->sixel.max_width)
|
||||
{
|
||||
resize(term, ph, pv);
|
||||
|
||||
/* This ensures the sixel’s final image size is *at least*
|
||||
* this large */
|
||||
term->sixel.max_non_empty_row_no =
|
||||
min(pv, term->sixel.image.height) - 1;
|
||||
}
|
||||
|
||||
term->sixel.state = SIXEL_DECSIXEL;
|
||||
|
|
|
|||
|
|
@ -620,7 +620,6 @@ struct terminal {
|
|||
} state;
|
||||
|
||||
struct coord pos; /* Current sixel coordinate */
|
||||
int max_non_empty_row_no;
|
||||
size_t row_byte_ofs; /* Byte position into image, for current row */
|
||||
int color_idx; /* Current palette index */
|
||||
uint32_t *private_palette; /* Private palette, used when private mode 1070 is enabled */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue