diff options
Diffstat (limited to 'sway/desktop/shaders/tex_rgbx.frag')
-rw-r--r-- | sway/desktop/shaders/tex_rgbx.frag | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sway/desktop/shaders/tex_rgbx.frag b/sway/desktop/shaders/tex_rgbx.frag index b31c1bfd..283963f2 100644 --- a/sway/desktop/shaders/tex_rgbx.frag +++ b/sway/desktop/shaders/tex_rgbx.frag @@ -2,6 +2,8 @@ precision mediump float; varying vec2 v_texcoord; uniform sampler2D tex; uniform float alpha; +uniform float dim; +uniform vec4 dim_color; uniform vec2 size; uniform vec2 position; @@ -11,14 +13,15 @@ uniform float saturation; const vec3 saturation_weight = vec3(0.2125, 0.7154, 0.0721); void main() { + vec4 color = vec4(texture2D(tex, v_texcoord).rgb, 1.0); // Saturation if (saturation != 1.0) { vec3 irgb = texture2D(tex, v_texcoord).rgb; vec3 target = vec3(dot(irgb, saturation_weight)); - gl_FragColor = vec4(mix(target, irgb, saturation), 1.0) * alpha; - } else { - gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0) * alpha; + color = vec4(mix(target, irgb, saturation), 1.0); } + // Dimming + gl_FragColor = mix(color, dim_color, dim) * alpha; if (!has_titlebar || gl_FragCoord.y - position.y > radius) { vec2 corner_distance = min(gl_FragCoord.xy - position, size + position - gl_FragCoord.xy); |