[mutter] meta-background-actor: Rename shader snippets



commit f381d7c3bfa6c24b53c725a70b53aac96bc42c5c
Author: Alessandro Bono <abono gnome org>
Date:   Sun Aug 20 13:14:19 2017 +0200

    meta-background-actor: Rename shader snippets
    
    Add the word 'vignette' in order to give some context on what the
    snippets do. This will be useful later when we land other snippets
    for the gradient effect.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786618

 src/compositor/meta-background-actor.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index fe1af56..fa46c0b 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -100,19 +100,19 @@ typedef enum {
   CHANGED_ALL = 0xFFFF
 } ChangedFlags;
 
-#define VERTEX_SHADER_DECLARATIONS                                      \
+#define VIGNETTE_VERTEX_SHADER_DECLARATIONS                             \
 "uniform vec2 scale;\n"                                                 \
 "uniform vec2 offset;\n"                                                \
 "varying vec2 position;\n"                                              \
 
-#define VERTEX_SHADER_CODE                                              \
+#define VIGNETTE_VERTEX_SHADER_CODE                                     \
 "position = cogl_tex_coord0_in.xy * scale + offset;\n"                  \
 
-#define FRAGMENT_SHADER_DECLARATIONS                                    \
+#define VIGNETTE_FRAGMENT_SHADER_DECLARATIONS                           \
 "uniform float vignette_sharpness;\n"                                   \
 "varying vec2 position;\n"                                              \
 
-#define FRAGMENT_SHADER_CODE                                                   \
+#define VIGNETTE_FRAGMENT_SHADER_CODE                                          \
 "float t = 2.0 * length(position);\n"                                          \
 "t = min(t, 1.0);\n"                                                           \
 "float pixel_brightness = 1.0 - t * vignette_sharpness;\n"                     \
@@ -245,20 +245,22 @@ make_pipeline (PipelineFlags pipeline_flags)
 
       if ((pipeline_flags & PIPELINE_VIGNETTE) != 0)
         {
-          static CoglSnippet *vertex_snippet;
-          static CoglSnippet *fragment_snippet;
+          static CoglSnippet *vignette_vertex_snippet;
+          static CoglSnippet *vignette_fragment_snippet;
 
-          if (!vertex_snippet)
-            vertex_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
-                                               VERTEX_SHADER_DECLARATIONS, VERTEX_SHADER_CODE);
+          if (!vignette_vertex_snippet)
+            vignette_vertex_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
+                                                        VIGNETTE_VERTEX_SHADER_DECLARATIONS,
+                                                        VIGNETTE_VERTEX_SHADER_CODE);
 
-          cogl_pipeline_add_snippet (*templatep, vertex_snippet);
+          cogl_pipeline_add_snippet (*templatep, vignette_vertex_snippet);
 
-          if (!fragment_snippet)
-            fragment_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
-                                                 FRAGMENT_SHADER_DECLARATIONS, FRAGMENT_SHADER_CODE);
+          if (!vignette_fragment_snippet)
+            vignette_fragment_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
+                                                          VIGNETTE_FRAGMENT_SHADER_DECLARATIONS,
+                                                          VIGNETTE_FRAGMENT_SHADER_CODE);
 
-          cogl_pipeline_add_snippet (*templatep, fragment_snippet);
+          cogl_pipeline_add_snippet (*templatep, vignette_fragment_snippet);
         }
 
       if ((pipeline_flags & PIPELINE_BLEND) == 0)


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