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
|
|
@ -77,7 +77,7 @@ treflow_moveimages(int oldy, int newy)
|
|||
void
|
||||
treflow(int col, int row)
|
||||
{
|
||||
int i, j, x, x2;
|
||||
int i, j;
|
||||
int oce, nce, bot, scr;
|
||||
int ox = 0, oy = -term.histf, nx = 0, ny = -1, len;
|
||||
int cy = -1; /* proxy for new y coordinate of cursor */
|
||||
|
|
@ -220,13 +220,12 @@ treflow(int col, int row)
|
|||
}
|
||||
|
||||
/* expand images into new text cells */
|
||||
for (im = term.images; im; im = next) {
|
||||
next = im->next;
|
||||
if (im->x < col) {
|
||||
line = TLINE(im->y);
|
||||
x2 = MIN(im->x + im->cols, col);
|
||||
for (x = im->x; x < x2; x++)
|
||||
line[x].mode |= ATTR_SIXEL;
|
||||
for (im = term.images; im; im = im->next) {
|
||||
j = MIN(im->x + im->cols, col);
|
||||
line = TLINE(im->y);
|
||||
for (i = im->x; i < j; i++) {
|
||||
if (!(line[i].mode & ATTR_SET))
|
||||
line[i].mode |= ATTR_SIXEL;
|
||||
}
|
||||
}
|
||||
#endif // SIXEL_PATCH
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue