aboutsummaryrefslogtreecommitdiff
path: root/terminal.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-03-04 15:40:16 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-03-06 15:37:54 +0000
commit1568518ab3c30ce9d83d6e2c4a9d8e74bbe15051 (patch)
tree3945648e3617d4d52f3024a7c38386f6a1ede5f5 /terminal.h
parentsixel: fix row height calculation in resize_vertically() (diff)
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.
Diffstat (limited to 'terminal.h')
-rw-r--r--terminal.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/terminal.h b/terminal.h
index 49c88926..ec2ff963 100644
--- a/terminal.h
+++ b/terminal.h
@@ -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;