[clutter/clutter-1.6] cogl-blend-string: Fix TEXTURE_N sources



commit 76fc6d9483c5404cc2c3b067270e8db44f82612e
Author: Neil Roberts <neil linux intel com>
Date:   Thu Aug 4 19:04:11 2011 +0100

    cogl-blend-string: Fix TEXTURE_N sources
    
    The parser couldn't cope with TEXTURE_N source arguments because the
    sources are checked in turn to find one that matches the beginning of
    the argument. The TEXTURE_N source was checked last so it would end up
    matching the regular 'TEXTURE' source and then the parser would choke
    when it tries to parse the trailing parts.
    
    This patch just moves the check for TEXTURE_ to the top. It also also
    changes it so that the argument only needs to be at least 8 characters
    long instead of 9. This is necessary because the parser doesn't
    consider the digits to be part of the name of the argument so while we
    are parsing 'TEXTURE_0' the length is only 8.
    
    Reviewed-by: Robert Bragg <robert linux intel com>
    
    Backported from 92704124957 of Cogl master

 clutter/cogl/cogl/cogl-blend-string.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/clutter/cogl/cogl/cogl-blend-string.c b/clutter/cogl/cogl/cogl-blend-string.c
index cd4443f..0c09110 100644
--- a/clutter/cogl/cogl/cogl-blend-string.c
+++ b/clutter/cogl/cogl/cogl-blend-string.c
@@ -438,6 +438,13 @@ get_color_src_info (const char *mark,
       array_len = G_N_ELEMENTS (tex_combine_color_sources);
     }
 
+  if (len >= 8 &&
+      strncmp (mark, "TEXTURE_", 8) == 0 &&
+      g_ascii_isdigit (mark[8]))
+    {
+      return &tex_combine_texture_n_color_source;
+    }
+
   for (i = 0; i < array_len; i++)
     {
       if (len >= sources[i].name_len
@@ -445,13 +452,6 @@ get_color_src_info (const char *mark,
         return &sources[i];
     }
 
-  if (len >= 9 &&
-      strncmp (mark, "TEXTURE_", 8) == 0 &&
-      g_ascii_isdigit (mark[8]))
-    {
-      return &tex_combine_texture_n_color_source;
-    }
-
   return NULL;
 }
 



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