sixel: improve the renderer (#143)
In the current implementation, when text is written over an image, we have to cut the entire text line out of the image, regardless of how long the text is. It doesn't look good, but it was a design choice for the following reasons: 1) To keep the sixel engine as fast as possible 2) Most applications do not write text on the images anyway To bring the st terminal in line with other terminals that support sixels, I have now improved the sixel renderer so that the images can now have gaps, which allows the text to be printed inside the images. The changes should not affect performance in normal cases. Only when the renderer has to deal with the text there might be some performance hits depending on how many gaps there are in the images.
This commit is contained in:
parent
48c85cdcf5
commit
7a581fe4e1
3 changed files with 61 additions and 47 deletions
15
st.c
15
st.c
|
|
@ -2748,7 +2748,11 @@ strhandle(void)
|
|||
} else {
|
||||
term.images = newimages;
|
||||
}
|
||||
#if COLUMNS_PATCH && !REFLOW
|
||||
x2 = MIN(x2, term.maxcol) - 1;
|
||||
#else
|
||||
x2 = MIN(x2, term.col) - 1;
|
||||
#endif // COLUMNS_PATCH
|
||||
if (IS_SET(MODE_SIXEL_SDM)) {
|
||||
/* Sixel display mode: put the sixel in the upper left corner of
|
||||
* the screen, disable scrolling (the sixel will be truncated if
|
||||
|
|
@ -3521,7 +3525,7 @@ tresize(int col, int row)
|
|||
#endif // COLUMNS_PATCH
|
||||
int *bp;
|
||||
#if SIXEL_PATCH
|
||||
int x, x2;
|
||||
int x2;
|
||||
Line line;
|
||||
ImageList *im, *next;
|
||||
#endif // SIXEL_PATCH
|
||||
|
|
@ -3628,8 +3632,7 @@ tresize(int col, int row)
|
|||
}
|
||||
|
||||
#if SIXEL_PATCH
|
||||
/* expand images into new text cells to prevent them from being deleted in
|
||||
* xfinishdraw() that draws the images */
|
||||
/* expand images into new text cells */
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (im = term.images; im; im = next) {
|
||||
next = im->next;
|
||||
|
|
@ -3654,9 +3657,9 @@ tresize(int col, int row)
|
|||
}
|
||||
line = term.line[im->y];
|
||||
#endif // SCROLLBACK_PATCH
|
||||
x2 = MIN(im->x + im->cols, term.col);
|
||||
for (x = im->x; x < x2; x++)
|
||||
line[x].mode |= ATTR_SIXEL;
|
||||
x2 = MIN(im->x + im->cols, col) - 1;
|
||||
if (mincol < col && x2 >= mincol && im->x < col)
|
||||
tsetsixelattr(line, MAX(im->x, mincol), x2);
|
||||
}
|
||||
tswapscreen();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue