summaryrefslogtreecommitdiff
path: root/sway/desktop/shaders/tex_rgba.frag
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/shaders/tex_rgba.frag')
-rw-r--r--sway/desktop/shaders/tex_rgba.frag9
1 files changed, 6 insertions, 3 deletions
diff --git a/sway/desktop/shaders/tex_rgba.frag b/sway/desktop/shaders/tex_rgba.frag
index 2a9dbccb..b46885b2 100644
--- a/sway/desktop/shaders/tex_rgba.frag
+++ b/sway/desktop/shaders/tex_rgba.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,15 +13,16 @@ uniform float saturation;
const vec3 saturation_weight = vec3(0.2125, 0.7154, 0.0721);
void main() {
+ vec4 color = texture2D(tex, v_texcoord);
// Saturation
if (saturation != 1.0) {
vec4 pixColor = texture2D(tex, 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(tex, v_texcoord) * alpha;
+ color = vec4(mix(target, irgb, saturation), pixColor.a);
}
+ // 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);