2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-script.c (resolve_alpha_func): Fix the
	ClutterAlphaFunc resolution function.
This commit is contained in:
Emmanuele Bassi 2007-10-09 20:04:23 +00:00
parent b1ed23e0df
commit 475fcc64a7
3 changed files with 14 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-script.c (resolve_alpha_func): Fix the
ClutterAlphaFunc resolution function.
2007-10-09 Emmanuele Bassi <ebassi@openedhand.com> 2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>
* tests/Makefile.am: * tests/Makefile.am:

View File

@ -187,6 +187,8 @@ resolve_alpha_func (const gchar *name)
if (!module) if (!module)
module = g_module_open (NULL, 0); module = g_module_open (NULL, 0);
CLUTTER_NOTE (SCRIPT, "Looking for `%s' alpha function", name);
if (g_module_symbol (module, name, (gpointer) &func)) if (g_module_symbol (module, name, (gpointer) &func))
return func; return func;
@ -195,21 +197,18 @@ resolve_alpha_func (const gchar *name)
for (i = 0; name[i] != '\0'; i++) for (i = 0; name[i] != '\0'; i++)
{ {
c = name[i]; c = name[i];
/* skip if uppercase, first or previous is uppercase */
if ((c == '-') || if (name[i] == '-')
(c == g_ascii_toupper (c) &&
i > 0 && name[i-1] != g_ascii_toupper (name[i-1])) ||
(i > 2 && name[i] == g_ascii_toupper (name[i]) &&
name[i-1] == g_ascii_toupper (name[i-1]) &&
name[i-2] == g_ascii_toupper (name[i-2])))
g_string_append_c (symbol_name, '_'); g_string_append_c (symbol_name, '_');
else
g_string_append_c (symbol_name, g_ascii_tolower (c)); g_string_append_c (symbol_name, g_ascii_tolower (name[i]));
} }
g_string_append (symbol_name, "_func"); g_string_append (symbol_name, "_func");
symbol = g_string_free (symbol_name, FALSE); symbol = g_string_free (symbol_name, FALSE);
CLUTTER_NOTE (SCRIPT, "Looking for `%s' alpha function", symbol);
if (!g_module_symbol (module, symbol, (gpointer)&func)) if (!g_module_symbol (module, symbol, (gpointer)&func))
func = NULL; func = NULL;

View File

@ -32,7 +32,7 @@ static const gchar *test_behaviour =
" \"opacity-end\" : 0," " \"opacity-end\" : 0,"
" \"alpha\" : {" " \"alpha\" : {"
" \"timeline\" : \"main-timeline\"," " \"timeline\" : \"main-timeline\","
" \"function\" : \"ramp\"" " \"function\" : \"ramp-inc\""
" }" " }"
" }" " }"
"]"; "]";