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:14:27 +0100
commit92704124957af137d0afbeeebc3884399b2405f9 (patch)
treef9f7fdad189bc5729845e50fc3cb85b4eb7148e2
parent89fd2edeb088570c4fcecbbffa404b65b3dad868 (diff)
downloadcogl-92704124957af137d0afbeeebc3884399b2405f9.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>
-rw-r--r--cogl/cogl-blend-string.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cogl/cogl-blend-string.c b/cogl/cogl-blend-string.c
index 1eb2a802..92c4cb14 100644
--- a/cogl/cogl-blend-string.c
+++ b/cogl/cogl-blend-string.c
@@ -439,6 +439,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
@@ -446,13 +453,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;
}