aboutsummaryrefslogtreecommitdiff
path: root/sixel.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-05-01 07:37:47 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-05-03 07:04:15 +0000
commit970e13db8deebf6c7542c7aede4f34703fa86769 (patch)
tree04db96b02d5a6b2c0c7df99cf3f896054b90c56a /sixel.c
parentosc: restore configured alpha if OSC-11 has no alpha value (diff)
config: tweak.surface-bit-depth: add support for 16-bit surfaces
This adds supports for 16-bit surfaces, using the new PIXMAN_a16b16g16r16 buffer format. This maps to WL_SHM_FORMAT_ABGR16161616 (little-endian). Use the new 16-bit surfaces by default, when gamma-correct-blending=yes.
Diffstat (limited to 'sixel.c')
-rw-r--r--sixel.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sixel.c b/sixel.c
index 680c258f..c5ef01a1 100644
--- a/sixel.c
+++ b/sixel.c
@@ -113,7 +113,18 @@ sixel_init(struct terminal *term, int p1, int p2, int p3)
term->sixel.linear_blending = wayl_do_linear_blending(term->wl, term->conf);
term->sixel.pixman_fmt = PIXMAN_a8r8g8b8;
- if (term->conf->tweak.surface_bit_depth == SHM_BITS_10) {
+ /*
+ * Use higher-precision sixel surfaces if we're using
+ * higher-precision window surfaces.
+ *
+ * This is to a) get more accurate colors when doing gamma-correct
+ * blending, and b) use the same pixman format as the main
+ * surfaces, for (hopefully) better performance.
+ *
+ * For now, don't support 16-bit surfaces (too much sixel logic
+ * that assumes 32-bit pixels).
+ */
+ if (shm_chain_bit_depth(term->render.chains.grid) >= SHM_BITS_10) {
if (term->wl->shm_have_argb2101010 && term->wl->shm_have_xrgb2101010) {
term->sixel.use_10bit = true;
term->sixel.pixman_fmt = PIXMAN_a2r10g10b10;