[gnome-shell] ScreenShield: unbreak blurring the background



commit 7bed964ab2836ead9650ccdc27b704f7d6fb9c6c
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Nov 7 19:04:12 2012 +0100

    ScreenShield: unbreak blurring the background
    
    It was missing a uniform, so it had no effect besides desaturation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682536

 js/ui/screenShield.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 881d667..fd16459 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -51,10 +51,11 @@ const SHORT_FADE_TIME = 0.3;
 
 function sample(offx, offy) {
     return 'texel += texture2D (sampler, tex_coord.st + pixel_step * ' +
-        'vec2 (' + offx + ',' + offy + ') * 2.0);\n'
+        'vec2 (' + offx + ',' + offy + '));\n'
 }
 const GLSL_BLUR_EFFECT_DECLARATIONS = ' \
 uniform vec2 pixel_step;\n \
+uniform float desaturation;\n \
 vec4 apply_blur(in sampler2D sampler, in vec2 tex_coord) {\n \
   vec4 texel;\n \
   texel = texture2D (sampler, tex_coord.st);\n'
@@ -62,7 +63,6 @@ vec4 apply_blur(in sampler2D sampler, in vec2 tex_coord) {\n \
   + sample( 0.0, -1.0)
   + sample(+1.0, -1.0)
   + sample(-1.0,  0.0)
-  + sample( 0.0,  0.0)
   + sample(+1.0,  0.0)
   + sample(-1.0, +1.0)
   + sample( 0.0, +1.0)
@@ -70,7 +70,7 @@ vec4 apply_blur(in sampler2D sampler, in vec2 tex_coord) {\n \
    texel /= 9.0;\n \
    return texel;\n \
 }\n \
-vec3 desaturate (const vec3 color, const float desaturation)\n \
+vec3 desaturate (const vec3 color)\n \
 {\n \
    const vec3 gray_conv = vec3 (0.299, 0.587, 0.114);\n \
    vec3 gray = vec3 (dot (gray_conv, color));\n \
@@ -78,7 +78,7 @@ vec3 desaturate (const vec3 color, const float desaturation)\n \
 }';
 const GLSL_BLUR_EFFECT_CODE = ' \
 cogl_texel = apply_blur(cogl_sampler, cogl_tex_coord.st);\n \
-cogl_texel.rgb = desaturate(cogl_texel.rgb, 0.6);\n';
+cogl_texel.rgb = desaturate(cogl_texel.rgb);\n';
 
 
 const Clock = new Lang.Class({
@@ -409,6 +409,12 @@ const ScreenShield = new Lang.Class({
                                          GLSL_BLUR_EFFECT_DECLARATIONS,
                                          GLSL_BLUR_EFFECT_CODE,
                                          true);
+        backgroundActor.set_uniform_float('desaturation',
+                                          1, 1, [0.6]);
+        backgroundActor.connect('notify::size', function(actor) {
+            actor.set_uniform_float('pixel_step', 2, 1, [1/actor.width, 1/actor.height]);
+        });
+
         this._background = new St.Bin({ style_class: 'screen-shield-background',
                                         child: backgroundActor });
         this._lockScreenGroup.add_actor(this._background);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]