summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-08-04 19:04:11 +0100
committerNeil Roberts <neil@linux.intel.com>2011-08-04 19:25:00 +0100
commit76fc6d9483c5404cc2c3b067270e8db44f82612e (patch)
treea05f7525a8aebfdf7d820d78de98f419acfac837
parentc89e83e2198706b86bb549a14364095a9ff6b3ce (diff)
downloadclutter-76fc6d9483c5404cc2c3b067270e8db44f82612e.tar.gz
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
-rw-r--r--clutter/cogl/cogl/cogl-blend-string.c14
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 cd4443f52..0c091100a 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;
}