Evas filters: Fix meaning of data 'execute' flag
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 2 Mar 2016 03:01:15 +0000 (12:01 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 2 Mar 2016 04:11:29 +0000 (13:11 +0900)
The doc said it would behave like "value = data" but actually
the data part was executed directly. This should fix that.

src/lib/edje/edje_calc.c
src/lib/efl/interfaces/efl_gfx_filter.eo
src/lib/evas/filters/evas_filter_parser.c

index 7a0fbce..55fb82f 100644 (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);
index f4aabf0..52267de 100644 (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]]
index 7f41234..f78c7c0 100644 (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;