From 3a34664483b236ee3b7e3c1c0283ef0e318ea7d7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Sep 2023 20:39:56 +0530 Subject: [PATCH] Adjust the workaround for non-linear blending of transparent pixels in compositors to hopefully further reduce fringing around text with certain color issues Fixes #6534 --- docs/changelog.rst | 4 ++++ kitty/cell_fragment.glsl | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 80663a85a..1c101db58 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -82,6 +82,10 @@ Detailed list of changes - Wayland: Do not request idle inhibition for full screen windows (:iss:`6613`) +- Adjust the workaround for non-linear blending of transparent pixels in + compositors to hopefully further reduce fringing around text with certain + color issues (:iss:`6534`) + 0.29.2 [2023-07-27] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/cell_fragment.glsl b/kitty/cell_fragment.glsl index f96c83e5b..9b953f644 100644 --- a/kitty/cell_fragment.glsl +++ b/kitty/cell_fragment.glsl @@ -160,8 +160,8 @@ float adjust_alpha_for_incorrect_blending_by_compositor(float text_fg_alpha, flo // background_opacity non-linear // See https://github.com/kovidgoyal/kitty/issues/6209 for discussion. const float threshold = 0.000001; - // linear2srgb(final_alpha) if text_fg_alpha >= threshold else final_alpha - return mix(final_alpha, linear2srgb(final_alpha), step(threshold, text_fg_alpha)); + // ans = text_fg_alpha * linear2srgb(final_alpha) + (1 - text_fg_alpha) * final_alpha + return mix(final_alpha, linear2srgb(final_alpha), text_fg_alpha); } void main() {