Evas filters: Fix meaning of data 'execute' flag

The doc said it would behave like "value = data" but actually
the data part was executed directly. This should fix that.
This commit is contained in:
Jean-Philippe Andre 2016-03-02 12:01:15 +09:00
parent bafe723991
commit bbc616e064
3 changed files with 7 additions and 3 deletions

View File

@ -2618,13 +2618,13 @@ _edje_part_recalc_single_filter(Edje *ed,
if (cc)
{
static const char fmt[] =
"%s={r=%d,g=%d,b=%d,a=%d,"
"{r=%d,g=%d,b=%d,a=%d,"
"r2=%d,g2=%d,b2=%d,a2=%d,"
"r3=%d,g3=%d,b3=%d,a3=%d}";
int len = sizeof(fmt) + 20;
len += strlen(data->name);
buffer = alloca(len);
snprintf(buffer, len - 1, fmt, data->name,
snprintf(buffer, len - 1, fmt,
(int) cc->r, (int) cc->g, (int) cc->b, (int) cc->a,
(int) cc->r2, (int) cc->g2, (int) cc->b2, (int) cc->a2,
(int) cc->r3, (int) cc->g3, (int) cc->b3, (int) cc->a3);

View File

@ -98,6 +98,7 @@ interface Efl.Gfx.Filter
If the $execute flag is set, then the $value can be complex and
run, as if the original Lua program contained a line 'name = value'.
This can be used to pass in tables.
]]
keys {
name: const(char)*; [[Name of the global variable]]

View File

@ -2726,7 +2726,10 @@ _filter_program_state_set(Evas_Filter_Program *pgm)
{
if (db->execute)
{
if (luaL_dostring(L, db->value) != 0)
char *buf = alloca(strlen(db->name) + strlen(db->value) + 4);
if (!buf) return EINA_FALSE;
sprintf(buf, "%s = %s", db->name, db->value);
if (luaL_dostring(L, buf) != 0)
{
ERR("Failed to run value: %s", lua_tostring(L, -1));
return EINA_FALSE;