diff options
Diffstat (limited to 'sway/desktop/shaders/tex_external.frag')
| -rw-r--r-- | sway/desktop/shaders/tex_external.frag | 13 | 
1 files changed, 12 insertions, 1 deletions
| diff --git a/sway/desktop/shaders/tex_external.frag b/sway/desktop/shaders/tex_external.frag index 0703a05f..d31cc990 100644 --- a/sway/desktop/shaders/tex_external.frag +++ b/sway/desktop/shaders/tex_external.frag @@ -9,9 +9,20 @@ uniform vec2 size;  uniform vec2 position;  uniform float radius;  uniform bool has_titlebar; +uniform float saturation; +const vec3 saturation_weight = vec3(0.2125, 0.7154, 0.0721);  void main() { -    gl_FragColor = texture2D(texture0, v_texcoord) * alpha; +    // Saturation +    if (saturation != 1.0) { +        vec4 pixColor = texture2D(texture0, v_texcoord); +        vec3 irgb = pixColor.rgb; +        vec3 target = vec3(dot(irgb, saturation_weight)); +        gl_FragColor = vec4(mix(target, irgb, saturation), pixColor.a) * alpha; +    } else { +        gl_FragColor = texture2D(texture0, v_texcoord) * alpha; +    } +      if (!has_titlebar || gl_FragCoord.y - position.y > radius) {          vec2 corner_distance = min(gl_FragCoord.xy - position, size + position - gl_FragCoord.xy);          if (max(corner_distance.x, corner_distance.y) < radius) { | 
