From fd375a7bc962517439303203cf7443caaf729e93 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 30 Aug 2012 21:02:38 -0300 Subject: [PATCH] blur-effect: Fix the blur filter Make sure we don't sample the center twice, and don't sample things that aren't our immediate neighbors. https://bugzilla.gnome.org/show_bug.cgi?id=683076 --- clutter/clutter-blur-effect.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clutter/clutter-blur-effect.c b/clutter/clutter-blur-effect.c index 1e36a0cbd..305e1f22b 100644 --- a/clutter/clutter-blur-effect.c +++ b/clutter/clutter-blur-effect.c @@ -58,18 +58,15 @@ */ static const gchar *box_blur_glsl_declarations = "uniform vec2 pixel_step;\n"; -/* FIXME: Is this shader right? It is doing 10 samples (ie, sampling - the middle texel twice) and then only dividing by 9 */ #define SAMPLE(offx, offy) \ "cogl_texel += texture2D (cogl_sampler, cogl_tex_coord.st + pixel_step * " \ - "vec2 (" G_STRINGIFY (offx) ", " G_STRINGIFY (offy) ") * 2.0);\n" + "vec2 (" G_STRINGIFY (offx) ", " G_STRINGIFY (offy) "));\n" static const gchar *box_blur_glsl_shader = " cogl_texel = texture2D (cogl_sampler, cogl_tex_coord.st);\n" SAMPLE (-1.0, -1.0) 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)