[mutter] background: Fix the desaturate effect when on its own



commit e216b6ca0fd968e42b612f0a0508f798756d0890
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Mar 18 13:27:47 2013 -0400

    background: Fix the desaturate effect when on its own
    
    We need to make sure cogl_texel is set to something,
    otherwise we'll have junk.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696087

 src/compositor/meta-background.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index fd2d1d2..7876d59 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -63,6 +63,11 @@
 "   return vec3(mix(color.rgb, gray, 1.0 - saturation));\n"                    \
 "}\n"                                                                          \
 
+/* Used when we don't have a blur, as the texel is going to be junk
+ * unless we set something to it. */
+#define DESATURATE_PRELUDE                                                     \
+"cogl_texel = texture2D(cogl_sampler, cogl_tex_coord.st);\n"
+
 #define DESATURATE_CODE                                                        \
 "cogl_texel.rgb = desaturate(cogl_texel.rgb);\n"
 
@@ -621,7 +626,7 @@ add_texture_lookup_shader (MetaBackground *self)
   else if (priv->effects & META_BACKGROUND_EFFECTS_BLUR)
     code = BLUR_CODE;
   else if (priv->effects & META_BACKGROUND_EFFECTS_DESATURATE)
-    code = DESATURATE_CODE;
+    code = DESATURATE_PRELUDE "\n" DESATURATE_CODE;
   else
     return;
 


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