mirror of
https://github.com/tmux/tmux.git
synced 2026-10-15 07:44:24 +00:00
Fallback image drawing.
This commit is contained in:
29
tty-draw.c
29
tty-draw.c
@@ -131,6 +131,10 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
enum tty_draw_line_state current_state, next_state;
|
||||
struct tty_style_ctx default_style_ctx = { 0 };
|
||||
const struct grid_cell *defaults;
|
||||
#ifdef ENABLE_IMAGES
|
||||
struct image *im;
|
||||
u_int x, y;
|
||||
#endif
|
||||
|
||||
if (style_ctx == NULL) {
|
||||
default_style_ctx.defaults = &grid_default_cell;
|
||||
@@ -188,6 +192,10 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
grid_view_get_cell(gd, i, py, &gc);
|
||||
if (~gc.flags & GRID_FLAG_PADDING)
|
||||
break;
|
||||
#ifdef ENABLE_IMAGES
|
||||
if (image_grid_get_at(gd, i, gd->hsize + py, &im, &x, &y) == 1)
|
||||
break;
|
||||
#endif
|
||||
cx++;
|
||||
}
|
||||
if (cx != 0) {
|
||||
@@ -254,21 +262,32 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
empty = nx - i;
|
||||
gcp = &grid_default_cell;
|
||||
|
||||
#ifdef ENABLE_IMAGES
|
||||
/* Map an image cell if needed. */
|
||||
gcp = fallback_map_cell(tty, gd, px + i,
|
||||
gd->hsize + py, gcp, &gc, &empty);
|
||||
#endif
|
||||
|
||||
/* Flush the background before clearing. */
|
||||
if (empty != 0 && gcp->bg != last.bg)
|
||||
empty = 0;
|
||||
} else {
|
||||
/* Get the current cell. */
|
||||
grid_view_get_cell(gd, px + i, py, &gc);
|
||||
gcp = &gc;
|
||||
|
||||
#ifdef ENABLE_IMAGES
|
||||
/* Map an image cell if needed. */
|
||||
gcp = fallback_map_cell(tty, gd, px + i,
|
||||
gd->hsize + py, gcp, &gc, NULL);
|
||||
#endif
|
||||
|
||||
/* Work out empty cells. */
|
||||
empty = tty_draw_line_get_empty(&gc, &last,
|
||||
empty = tty_draw_line_get_empty(gcp, &last,
|
||||
nx - i);
|
||||
if (empty != 0)
|
||||
gcp = &gc;
|
||||
else {
|
||||
if (empty == 0) {
|
||||
/* Update for codeset if needed. */
|
||||
gcp = tty_check_codeset(tty, &gc);
|
||||
gcp = tty_check_codeset(tty, gcp);
|
||||
|
||||
/* And for selection. */
|
||||
if (gcp->flags & GRID_FLAG_SELECTED) {
|
||||
|
||||
Reference in New Issue
Block a user