From 74862a32b849caadc64cccd858a767ff65d9de20 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 18 Apr 2021 04:12:19 -0400 Subject: [PATCH] kitty: partial sprixcells cannot be opaque #1553 --- src/lib/kitty.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/kitty.c b/src/lib/kitty.c index 7ea870005..31887cf15 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -307,6 +307,23 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, if(fclose(fp) == EOF){ return -1; } + // any sprixcells which don't cover the full cell underneath them cannot + // be SPRIXCELL_OPAQUE + if(lenx % cdimx){ + for(y = 0 ; y < (leny + cdimy - 1) / cdimy ; ++y){ + if(tacache[y * cols + cols - 1] == SPRIXCELL_OPAQUE){ + tacache[y * cols + cols - 1] = SPRIXCELL_MIXED; + } + } + } + if(leny % cdimy){ + y = (leny + cdimy - 1) / cdimy - 1; + for(x = 0 ; x < cols ; ++x){ + if(tacache[y * cols + x] == SPRIXCELL_OPAQUE){ + tacache[y * cols + x] = SPRIXCELL_MIXED; + } + } + } return 0; } #undef RGBA_MAXLEN