aboutsummaryrefslogtreecommitdiff
path: root/sixel.c (follow)
Commit message (Collapse)AuthorAgeLines
* sixel: remove sixel-to-be-splitted *before* splitting itDaniel Eklöf2020-07-23-4/+8
| | | | | This fixes an assertion in debug builds, due to the pre-splitted and splitted sixels overlapping.
* sixel: overwrite: use target sixel's height, not cell heightDaniel Eklöf2020-07-23-2/+2
| | | | | | | When copying the image data for the left and right parts of the splitted images, use the sixel's height, not the cell height. This fixes a crash when the sixel didn't cover the entire cell height.
* sixel: verify list order: fix assertion when two sixels are on the same rowDaniel Eklöf2020-07-16-2/+22
| | | | | Two sixel may in fact exist on the same row, assuming their columns don't overlap.
* term: rename term_formfeed() -> term_carriage_return()Daniel Eklöf2020-07-14-1/+1
|
* sixel: overwrite_by_row: handle case where 'width' goes past end of rowDaniel Eklöf2020-07-07-1/+4
| | | | Cap 'width' to maximum number of columns available.
* Merge branch 'master' into sixel-performanceDaniel Eklöf2020-06-29-0/+11
|\
| * sixel: destroy all sixels when font size is decreasedDaniel Eklöf2020-06-29-0/+11
| | | | | | | | | | | | If changing the font size causes the cell size to decrease, either horizontally or vertically (or both), then delete all sixels since the grid space they allocated no longer is enough to hold the images.
* | scroll: destroy scrolled out sixels before scroll is appliedDaniel Eklöf2020-06-29-127/+55
| | | | | | | | | | | | | | | | | | | | | | | | The logic that breaks out of sixel loops does not work for rows that has already wrapped around. Thus, we need to destroy sixels that are about to be scrolled out *before* we actually scroll. Since this is the *only* time we destroy sixels (instead of overwriting it), rename the sixel functions. And, since they now do a very specific thing, they can be greatly simplified (and thus faster).
* | sixel: overwrite-by-rectangle: optimize: break out of loop as soon as possibleDaniel Eklöf2020-06-28-0/+18
| | | | | | | | | | | | | | | | | | Since the images are sorted, we can break out of the loop as soon as we detect an image that *ends before* the rectangle's top starts. In order for the row comparisons to work, the row numbers must be re-based against the current scrollback offset, or the scrollback *end*, to be precise.
* | sixel: overwrite-by-row: optimize: break out of loop as soon as possibleDaniel Eklöf2020-06-28-14/+24
| | | | | | | | | | | | | | | | | | Since the images are sorted, we can break out of the loop as soon as we detect an image that *ends before* the row we're looking for. In order for the row comparisons to work, the row numbers must be re-based against the current scrollback offset, or the scrollback *end*, to be precise.
* | sixel: overwrite: pass 'width' to sixel_overwrite_at_cursor()Daniel Eklöf2020-06-28-2/+2
| | | | | | | | This is necessary to handle multi-column characters correctly.
* | sixel: insert: calculate end rows in a single statementDaniel Eklöf2020-06-28-8/+21
| |
* | sixel: insert: sort sixels such that those furthest up in the scrollback is at the backDaniel Eklöf2020-06-28-0/+19
| |
* | sixel: add local function sixel_insert()Daniel Eklöf2020-06-28-2/+8
|/ | | | Replace all tll_push_*() calls with calls to this function.
* sixel: split -> overwriteDaniel Eklöf2020-06-27-15/+15
|
* term: erasing characters now splits sixels instead of deleting themDaniel Eklöf2020-06-27-12/+22
|
* sixel: delete/split: early(ier) exit when there aren't in sixel imagesDaniel Eklöf2020-06-27-9/+16
| | | | Avoid unnecessary wrap checks if the sixel image list is empty.
* sixel: split: make pixman instantiation genericDaniel Eklöf2020-06-27-34/+27
|
* sixel: never generate scrollback wrapping sixel imagesDaniel Eklöf2020-06-27-53/+96
| | | | | | Instead, split them up into two (or more...). This makes the intersection detection logic *much* simpler.
* sixel: refactor handling of wrap-around delete- and split regionsDaniel Eklöf2020-06-27-39/+99
| | | | | | | | | Handle these on a higher abstraction level. The low level functions that detect sixel intersections now assume the specified rectangle (or line region) does *not* cross the wrap-around. This is ensured by detecting a wrap-around region before hand, and splitting it up into two, non wrapping regions.
* sixel: split_by_rectangle: bug: typo in boundary checkDaniel Eklöf2020-06-27-1/+1
|
* sixel: split: make sure relative row/column values are boundedDaniel Eklöf2020-06-27-4/+4
|
* sixel: split: push front instead of backDaniel Eklöf2020-06-27-4/+4
| | | | | | This reduces the burden on sixel_split_by_rectangle(), which would otherwise consider the newly added/splitted sixels. Since we already know they aren't covered by the specified rectangle, we can skip that.
* sixel: add sixel_split_by_rectangle()Daniel Eklöf2020-06-27-57/+74
| | | | | | | | | This function splits a sixel image into up to four pieces. The four pieces correspond to the relative complement (set difference) of the sixel image and the specified rectangle. Use this function when (possibly) overwriting existing sixel images when generating a new one, i.e. in sixel_unhook().
* sixel: hopefully fix erasing of scrollback wrap-around sixelsDaniel Eklöf2020-06-27-10/+27
| | | | | | If a sixel image crossed the scrollback wrap around, the logic that detected whether a row, or a row range, intersected with the sixel was incorrect.
* sixel: wip: split up image being overwritten, rather than erasing itDaniel Eklöf2020-06-23-1/+139
| | | | | | | | | | Instead of completely erasing a sixel image when it is being "overwritten" (text is printed somewhere within the image, or another sixel image is emitted within the first image), split it up into up to four pieces: 'above', 'below', 'to-the-left' and 'to-the-right'. This is currently very un-optimized, but seems to produce correct results.
* sixel: if the client has specified a size, do not change thatDaniel Eklöf2020-06-11-5/+16
| | | | | | | | | | | | | We used to auto-resize images to always be a multiple of 6. This is incorrect. The client may, for example, have specified a size to align the image to a cell boundary, which may not be a multiple of 6. Furthermore, in e.g. Jexer, which splits up an image into stripes, that the next image would "overwrite" the previous one. Since the next image was started on a cell row that the previous image had overflowed into.
* sixel: only use configured alpha when color matches the default bgDaniel Eklöf2020-06-10-4/+11
|
* sixel: don't erase if cursor is *before* the imageDaniel Eklöf2020-06-10-1/+2
|
* sixel: do not reset palette after each imageDaniel Eklöf2020-06-10-5/+18
| | | | | | | | A client can re-use the palette between images. Resetting the palette breaks this. Now we initialize the palette on demand, and resets it when the palette size is changed (by the client).
* sixel: log message: fix spellingDaniel Eklöf2020-06-09-1/+1
|
* sixel: don't erase image when printing text *next* to it.Daniel Eklöf2020-06-06-5/+18
|
* sixel: fix asan runtime warning: left shift of 255 by 24 cannot...Daniel Eklöf2020-06-06-4/+4
| | | | be represented in type 'int'
* util.h: new header file defining commonly used macrosDaniel Eklöf2020-05-01-5/+1
|
* grid: move 'cursor' state from terminal to gridDaniel Eklöf2020-04-16-3/+3
| | | | | This way, the 'normal' and 'alt' grids have their own cursor state, and we don't need to switch between them.
* sixel: improve handling of images when reflowing the gridsDaniel Eklöf2020-03-13-14/+7
| | | | | | | | | | | 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.
* sixel: don't try to dirty an un-allocated rowDaniel Eklöf2020-03-06-0/+5
| | | | This may happen e.g. when resizing a grid
* sixel: CSI setters also write a reply to the clientDaniel Eklöf2020-02-24-5/+9
|
* term: term_erase(): call sixel_delete_*()Daniel Eklöf2020-02-24-2/+2
| | | | | This ensures sixel images are removed, regardless of _how_ the screen was erased.
* sixel: ensure 'start' row is not outside the grid row rangeDaniel Eklöf2020-02-24-1/+3
|
* sixel: add sixel_delete_at_row and sixel_delete_in_rangeDaniel Eklöf2020-02-24-7/+65
| | | | | These are utility functions to erase sixel images that are at the specified row, or in a row range.
* sixel: destroy_at_cursor(): skip images on 'other' gridDaniel Eklöf2020-02-22-0/+3
|
* sixel: track which grid image was created onDaniel Eklöf2020-02-22-0/+1
|
* sixel: rename: purge_at_cursor() -> delete_at_cursor()Daniel Eklöf2020-02-22-2/+2
|
* sixel: purge images in unhook, rather than in initDaniel Eklöf2020-02-22-2/+2
| | | | | This fixes an issue where the cursor was seen blinking in animated GIFs.
* sixel: purge images at current cursor rowDaniel Eklöf2020-02-22-7/+18
| | | | | When printing a character, or starting a new sixel image, purge all images that cover the cursor's current row.
* sixel: oopsDaniel Eklöf2020-02-22-2/+2
|
* sixel: don't ever shrink the imageDaniel Eklöf2020-02-22-3/+9
|
* sixel: add HLS color format supportDaniel Eklöf2020-02-22-2/+5
|
* sixel: add comments to max_width()/max_height()Daniel Eklöf2020-02-22-0/+2
|
* sixel: application configurable image max width/heightDaniel Eklöf2020-02-22-3/+72
|
* sixel: application configurable palette size (color count)Daniel Eklöf2020-02-22-6/+35
| | | | | This implements the CSI escapes for retrieving and (re)setting the palette size.
* sixel: use terminal's background color, not palette[0]Daniel Eklöf2020-02-22-3/+3
|
* sixel: finalize: use width/height from image, not row/col posDaniel Eklöf2020-02-22-10/+4
|
* sixel: resize: initialize new rows/columns with the background colorDaniel Eklöf2020-02-22-9/+15
|
* sixel: mention why we add oneDaniel Eklöf2020-02-22-1/+3
|
* sixel: clean up state machineDaniel Eklöf2020-02-22-91/+97
| | | | | Use proper state names, and implement the state machine using switch statements.
* sixel: use a struct coord for current sixel positionDaniel Eklöf2020-02-22-24/+22
|
* sixel: rename state SIXEL_SIXEL -> SIXEL_GROUNDDaniel Eklöf2020-02-22-6/+6
|
* sixel: raster: only resize image buffer if necessaryDaniel Eklöf2020-02-22-1/+3
|
* sixel: resize image buffer after receiving a "raster" commandDaniel Eklöf2020-02-22-0/+1
|
* sixel: resize image buffer dynamicallyDaniel Eklöf2020-02-22-23/+80
|
* sixel: add sixel_destroy()Daniel Eklöf2020-02-21-4/+13
|
* sixel: always bump row on unhookDaniel Eklöf2020-02-21-6/+4
|
* sixel: ugly hack to remove over-written sixel imagesDaniel Eklöf2020-02-21-0/+8
|
* sixel: calculate image height in (cell) rowsDaniel Eklöf2020-02-21-0/+1
|
* sixel: wip: maintain a list of finished, and "active" sixel imagesDaniel Eklöf2020-02-21-24/+20
| | | | | | | | | | | | | | | | | | | In unhook, add the generated image to a list of finished sixel images, along with positioning and size information. When rendering, loop this list of images, and render the images (or parts of) that are visible. When scrolling, check if any part of the images cover the re-cycled lines, and if so, remove the *entire* image from the list. This means we have the following limitations: * The renderer always renders the whole (visible area of) the image(s). There are times when this isn't necessary - for example, when the image is scrolled inside the visible area. * It would be nice if we could crop the image when parts of it is scrolled out.
* sixel: initial supportDaniel Eklöf2020-02-21-0/+284
This implements basic parsing of sixel data. Lots of limitations and temporary solutions as this is still work-in-progress: * Maximum image size hardcoded to 800x800 * No HLS color format support * Image is always rendered at 0x0 in the terminal