mirror of
https://github.com/yshui/picom.git
synced 2024-10-27 05:24:17 -04:00
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 <yshuiv7@gmail.com>
This commit is contained in:
parent
e63ec3fd16
commit
f8914dda23
1 changed files with 5 additions and 1 deletions
|
@ -1550,16 +1550,20 @@ const char *win_shader_glsl = GLSL(330,
|
||||||
vec4 border_color = texture(tex, vec2(0.0, 0.5));
|
vec4 border_color = texture(tex, vec2(0.0, 0.5));
|
||||||
if (invert_color) {
|
if (invert_color) {
|
||||||
c = vec4(c.aaa - c.rgb, c.a);
|
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;
|
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;
|
vec3 rgb_brightness = texelFetch(brightness, ivec2(0, 0), 0).rgb;
|
||||||
// Ref: https://en.wikipedia.org/wiki/Relative_luminance
|
// Ref: https://en.wikipedia.org/wiki/Relative_luminance
|
||||||
float brightness = rgb_brightness.r * 0.21 +
|
float brightness = rgb_brightness.r * 0.21 +
|
||||||
rgb_brightness.g * 0.72 +
|
rgb_brightness.g * 0.72 +
|
||||||
rgb_brightness.b * 0.07;
|
rgb_brightness.b * 0.07;
|
||||||
if (brightness > max_brightness)
|
if (brightness > max_brightness) {
|
||||||
c.rgb = c.rgb * (max_brightness / 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
|
// 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.
|
// border, it's the color of the window itself, otherwise it's the border.
|
||||||
|
|
Loading…
Reference in a new issue