Make blur work with ARGB windows

svn path=/trunk/KDE/kdebase/workspace/; revision=713247
This commit is contained in:
Rivo Laks 2007-09-16 20:01:13 +00:00
parent 4449f0b214
commit 3afcb6eb04

View file

@ -17,22 +17,26 @@ vec2 pix2tex(vec2 pix)
// account opacity, brightness and saturation // account opacity, brightness and saturation
vec4 windowColor(vec2 texcoord) vec4 windowColor(vec2 texcoord)
{ {
vec3 color = texture2D(windowTex, texcoord).rgb; vec4 color = texture2D(windowTex, texcoord);
// Apply saturation // Apply saturation
float grayscale = dot(vec3(0.30, 0.59, 0.11), color.rgb); 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 // Apply brightness
color = color * brightness; color.rgb = color.rgb * brightness;
// Apply opacity and return // Apply opacity
return vec4(color, opacity); color.a = color.a * opacity;
// and return
return color;
} }
void main() void main()
{ {
vec2 texcoord = (gl_TexCoord[0] * gl_TextureMatrix[0]).xy; vec2 texcoord = (gl_TexCoord[0] * gl_TextureMatrix[0]).xy;
vec2 blurtexcoord = pix2tex(gl_FragCoord.xy); //(gl_FragCoord * gl_TextureMatrix[4]).xy; vec2 blurtexcoord = pix2tex(gl_FragCoord.xy); //(gl_FragCoord * gl_TextureMatrix[4]).xy;
vec4 winColor = windowColor(texcoord);
vec3 tex = mix(texture2D(backgroundTex, blurtexcoord).rgb, vec3 tex = mix(texture2D(backgroundTex, blurtexcoord).rgb,
windowColor(texcoord).rgb, opacity); winColor.rgb, winColor.a * opacity);
gl_FragColor = vec4(tex, 1.0); gl_FragColor = vec4(tex, 1.0);
} }