From 3afcb6eb04db68699d2236a6091773444dd46429 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Sun, 16 Sep 2007 20:01:13 +0000 Subject: [PATCH] Make blur work with ARGB windows svn path=/trunk/KDE/kdebase/workspace/; revision=713247 --- effects/data/blur-render.frag | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/effects/data/blur-render.frag b/effects/data/blur-render.frag index 7cda37191e..7f8650c82e 100644 --- a/effects/data/blur-render.frag +++ b/effects/data/blur-render.frag @@ -17,22 +17,26 @@ vec2 pix2tex(vec2 pix) // account opacity, brightness and saturation vec4 windowColor(vec2 texcoord) { - vec3 color = texture2D(windowTex, texcoord).rgb; + vec4 color = texture2D(windowTex, texcoord); // Apply saturation float grayscale = dot(vec3(0.30, 0.59, 0.11), color.rgb); - color = mix(vec3(grayscale), color, saturation); + color.rgb = mix(vec3(grayscale), color.rgb, saturation); // Apply brightness - color = color * brightness; - // Apply opacity and return - return vec4(color, opacity); + color.rgb = color.rgb * brightness; + // Apply opacity + color.a = color.a * opacity; + // and return + return color; } void main() { vec2 texcoord = (gl_TexCoord[0] * gl_TextureMatrix[0]).xy; vec2 blurtexcoord = pix2tex(gl_FragCoord.xy); //(gl_FragCoord * gl_TextureMatrix[4]).xy; + + vec4 winColor = windowColor(texcoord); vec3 tex = mix(texture2D(backgroundTex, blurtexcoord).rgb, - windowColor(texcoord).rgb, opacity); + winColor.rgb, winColor.a * opacity); gl_FragColor = vec4(tex, 1.0); }