sixel: improve handling of images when reflowing the grids

Update the sixels' 'row' attribute when re-flowing a grid, to ensure
it is rendered at the correct place.

This should work in most cases, but will break when the cell size has
changed (e.g. font size increase/decrease, or a DPI change).

This patch also moves the sixel image list from the terminal struct
into the grid struct. The sixels are per-grid after all.
This commit is contained in:
Daniel Eklöf 2020-03-13 18:44:23 +01:00
parent 62a5805d4b
commit d482bf0a30
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 69 additions and 42 deletions

View file

@ -86,6 +86,15 @@ struct row {
bool linebreak;
};
struct sixel {
void *data;
pixman_image_t *pix;
int width;
int height;
int rows;
struct coord pos;
};
struct grid {
int num_rows;
int num_cols;
@ -97,6 +106,7 @@ struct grid {
tll(struct damage) damage;
tll(struct damage) scroll_damage;
tll(struct sixel) sixel_images;
};
struct vt_subparams {
@ -175,16 +185,6 @@ struct ptmx_buffer {
size_t idx;
};
struct sixel {
void *data;
pixman_image_t *pix;
int width;
int height;
int rows;
const struct grid *grid;
struct coord pos;
};
enum term_surface {
TERM_SURF_NONE,
TERM_SURF_GRID,
@ -417,8 +417,6 @@ struct terminal {
unsigned max_height; /* Maximum image height, in pixels */
} sixel;
tll(struct sixel) sixel_images;
bool hold_at_exit;
bool is_shutting_down;
void (*shutdown_cb)(void *data, int exit_code);