mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-21 06:46:34 -04:00
sixel: performance improvements
* Store pointer to current pixel (i.e. pixel we're about to write to), instead of a row-byte-offset. This way, we don't have to calculate the offset into the backing image every time we emit a sixel band. * Pass data pointer directly to sixel_add_*(), to avoid having to calculate an offset into the backing image. * Special case adding a single 1:1 sixel. This removes a for loop, and simplifies state (position) updates. It is likely LTO does this for us, but this way, we get it optimized in non-LTO builds as well.
This commit is contained in:
parent
8ff8ec5b70
commit
1568518ab3
2 changed files with 61 additions and 29 deletions
|
|
@ -666,7 +666,6 @@ struct terminal {
|
|||
} state;
|
||||
|
||||
struct coord pos; /* Current sixel coordinate */
|
||||
size_t row_byte_ofs; /* Byte position into image, for current row */
|
||||
int color_idx; /* Current palette index */
|
||||
uint32_t *private_palette; /* Private palette, used when private mode 1070 is enabled */
|
||||
uint32_t *shared_palette; /* Shared palette, used when private mode 1070 is disabled */
|
||||
|
|
@ -675,6 +674,7 @@ struct terminal {
|
|||
|
||||
struct {
|
||||
uint32_t *data; /* Raw image data, in ARGB */
|
||||
uint32_t *p; /* Pointer into data, for current position */
|
||||
int width; /* Image width, in pixels */
|
||||
int height; /* Image height, in pixels */
|
||||
} image;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue