From f8914dda23247b9de2dbf864596601f6d9b22ac2 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 13 Feb 2022 13:54:25 +0000 Subject: [PATCH] backend: gl: apply postprocessing to border_color Previously postprocessing is omitted when estimating the color of the border (e.g. dimming, opacity, inversion, etc.), causing the border to be drawn with the wrong color. Related: #770 Signed-off-by: Yuxuan Shui --- src/backend/gl/gl_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index dda99f89..0955ee73 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -1550,16 +1550,20 @@ const char *win_shader_glsl = GLSL(330, vec4 border_color = texture(tex, vec2(0.0, 0.5)); if (invert_color) { c = vec4(c.aaa - c.rgb, c.a); + border_color = vec4(border_color.aaa - border_color.rgb, border_color.a); } c = vec4(c.rgb * (1.0 - dim), c.a) * opacity; + border_color = vec4(border_color.rgb * (1.0 - dim), border_color.a) * opacity; vec3 rgb_brightness = texelFetch(brightness, ivec2(0, 0), 0).rgb; // Ref: https://en.wikipedia.org/wiki/Relative_luminance float brightness = rgb_brightness.r * 0.21 + rgb_brightness.g * 0.72 + rgb_brightness.b * 0.07; - if (brightness > max_brightness) + if (brightness > max_brightness) { c.rgb = c.rgb * (max_brightness / brightness); + border_color.rgb = border_color.rgb * (max_brightness / brightness); + } // Rim color is the color of the outer rim of the window, if there is no // border, it's the color of the window itself, otherwise it's the border.