mirror of
https://github.com/tmux/tmux.git
synced 2026-09-05 13:10:45 +00:00
image: simplify geometry cleanup
This commit is contained in:
@@ -1307,13 +1307,6 @@ sixel_free_output(struct tty *tty, __unused int send)
|
||||
tty->image_data = NULL;
|
||||
}
|
||||
|
||||
/* Discard SIXEL output state after a terminal geometry change. */
|
||||
void
|
||||
sixel_geometry_changed(struct tty *tty)
|
||||
{
|
||||
sixel_free_output(tty, !!(tty->flags & TTY_OPENED));
|
||||
}
|
||||
|
||||
/* Render an image at a terminal's current pixel geometry. */
|
||||
static struct sixel_image *
|
||||
sixel_render_image(struct image *im, u_int xpixel, u_int ypixel)
|
||||
|
||||
10
image.c
10
image.c
@@ -88,16 +88,14 @@ struct image_backend {
|
||||
void (*draw_rect)(struct tty *,
|
||||
const struct image_rect *, const struct tty_style_ctx *);
|
||||
void (*free)(struct tty *, int);
|
||||
void (*geometry_changed)(struct tty *);
|
||||
};
|
||||
|
||||
static const struct image_backend image_backend_fallback = {
|
||||
"fallback", IMAGE_BACKEND_SCROLLS, NULL, NULL, NULL
|
||||
"fallback", IMAGE_BACKEND_SCROLLS, NULL, NULL
|
||||
};
|
||||
static const struct image_backend image_backend_sixel = {
|
||||
"sixel", IMAGE_BACKEND_GRAPHICAL|IMAGE_BACKEND_TEMPORAL,
|
||||
sixel_draw_rect,
|
||||
sixel_free_output, sixel_geometry_changed
|
||||
sixel_draw_rect, sixel_free_output
|
||||
};
|
||||
|
||||
/* Find the image backend supported by a terminal. */
|
||||
@@ -141,8 +139,8 @@ void
|
||||
image_tty_geometry_changed(struct tty *tty)
|
||||
{
|
||||
image_tty_update(tty);
|
||||
if (tty->image_backend->geometry_changed != NULL)
|
||||
tty->image_backend->geometry_changed(tty);
|
||||
if (tty->image_backend->free != NULL)
|
||||
tty->image_backend->free(tty, !!(tty->flags & TTY_OPENED));
|
||||
}
|
||||
|
||||
/* Free image backend state for a terminal. */
|
||||
|
||||
3
tmux.h
3
tmux.h
@@ -4295,9 +4295,8 @@ void image_get_fallback_cell(struct tty *, struct image *, u_int,
|
||||
/* image-sixel.c */
|
||||
#define SIXEL_COLOUR_REGISTERS 1024
|
||||
void sixel_draw_rect(struct tty *,
|
||||
const struct image_rect *, const struct tty_style_ctx *);
|
||||
const struct image_rect *, const struct tty_style_ctx *);
|
||||
void sixel_free_output(struct tty *, int);
|
||||
void sixel_geometry_changed(struct tty *);
|
||||
struct sixel_image *sixel_parse(const char *, size_t, u_int, u_int, u_int);
|
||||
void sixel_free(struct sixel_image *);
|
||||
void sixel_log(struct sixel_image *);
|
||||
|
||||
Reference in New Issue
Block a user