Evas filters: Fix buffer_push and add support for color classes

Makes sure that buffers don't override already existing
globals vars such as 'mask' (a function name). Yeah, it happened
to me.

CC support is a little bit hackish. Need to find a better way.
This commit is contained in:
Jean-Philippe Andre 2015-06-23 11:44:54 +09:00
parent 0e8f890dfb
commit 0df37da435
1 changed files with 28 additions and 4 deletions

View File

@ -2297,7 +2297,19 @@ _filter_program_buffers_set(Evas_Filter_Program *pgm)
const char *source;
EINA_ITERATOR_FOREACH(it, source)
_buffer_add(pgm, source, EINA_FALSE, source, EINA_FALSE);
{
// Cleanup name and avoid overriding existing globals
char name[64];
unsigned i;
snprintf(name, 64, "__source_%s", source);
name[63] = '\0';
for (i = 0; name[i]; i++)
{
if (!isdigit(name[i]) && !isalpha(name[i]))
name[i] = '_';
}
_buffer_add(pgm, name, EINA_FALSE, source, EINA_FALSE);
}
eina_iterator_free(it);
}
@ -2631,10 +2643,22 @@ _filter_program_state_set(Evas_Filter_Program *pgm)
const char *name = tup->key;
const char *value = tup->data;
if (value)
lua_pushstring(L, value);
{
if ((value[0] == '-') && (value[1] == '-') && value[2] == '\n')
{
int i = luaL_dostring(L, value);
ERR("i %d", i);
}
else
{
lua_pushstring(L, value);
lua_setglobal(L, name);
}
}
else
lua_pushnil(L);
lua_setglobal(L, name);
{
lua_pushnil(L);
}
}
eina_iterator_free(it);
}