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>
This commit is contained in:
Neil Roberts 2011-08-04 19:04:11 +01:00
parent 89fd2edeb0
commit 9270412495

View File

@ -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;
}