aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-05-28 10:12:18 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-25 14:36:08 +0900
commit1b2819f2cbe3aa1970ea2467f01b07b24f793f4d (patch)
treede5b686b787ec150c467af6562655b8331784b65 /src/lib/evas
parentEvas filters: Pass text colors to the parser (diff)
downloadefl-1b2819f2cbe3aa1970ea2467f01b07b24f793f4d.tar.gz
Evas filters: Implement __index for Lua buffer objects
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/canvas/evas_object_image.c5
-rw-r--r--src/lib/evas/canvas/evas_object_text.c2
-rw-r--r--src/lib/evas/filters/evas_filter.c2
-rw-r--r--src/lib/evas/filters/evas_filter_parser.c60
4 files changed, 64 insertions, 5 deletions
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index a272206bc6..bca2af5393 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -3268,6 +3268,9 @@ start_draw:
W = obj->cur->geometry.w;
H = obj->cur->geometry.h;
+ if (pgm && evas_filter_program_state_set(pgm, eo_obj, obj))
+ redraw = EINA_TRUE;
+
if (!redraw && o->cur->filter->output)
{
if (eina_hash_population(o->cur->filter->sources) > 0)
@@ -3306,6 +3309,7 @@ start_draw:
{
pgm = evas_filter_program_new("Image", EINA_FALSE);
evas_filter_program_source_set_all(pgm, o->cur->filter->sources);
+ evas_filter_program_state_set(pgm, eo_obj, obj);
ok = evas_filter_program_parse(pgm, o->cur->filter->code);
if (!ok) goto state_write;
}
@@ -4836,6 +4840,7 @@ _evas_image_filter_program_set(Eo *eo_obj, Evas_Image_Data *o, const char *arg)
{
pgm = evas_filter_program_new("Evas_Text: Filter Program", EINA_FALSE);
evas_filter_program_source_set_all(pgm, fcow->sources);
+ evas_filter_program_state_set(pgm, eo_obj, obj);
if (!evas_filter_program_parse(pgm, arg))
{
ERR("Parsing failed!");
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 39e6c62865..6fb4335d23 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -1783,6 +1783,7 @@ evas_object_text_render(Evas_Object *eo_obj,
Evas_Filter_Program *pgm;
pgm = evas_filter_program_new("Evas_Text", EINA_TRUE);
evas_filter_program_source_set_all(pgm, fcow->sources);
+ evas_filter_program_state_set(pgm, eo_obj, obj);
if (!evas_filter_program_parse(pgm, fcow->code))
{
ERR("Filter program parsing failed");
@@ -1795,7 +1796,6 @@ evas_object_text_render(Evas_Object *eo_obj,
}
fcow->chain = pgm;
fcow->invalid = EINA_FALSE;
- evas_filter_program_state_set(fcow->chain, eo_obj, obj);
}
else if (previous && !fcow->changed)
{
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index 1a8c2ed291..dd9fdc5e6f 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -1905,7 +1905,7 @@ _filter_command_run(Evas_Filter_Command *cmd)
if (!func)
{
- CRI("No function to process this filter!");
+ ERR("No function to process this filter!");
return EINA_FALSE;
}
diff --git a/src/lib/evas/filters/evas_filter_parser.c b/src/lib/evas/filters/evas_filter_parser.c
index e1a59d20a7..60a93fe8db 100644
--- a/src/lib/evas/filters/evas_filter_parser.c
+++ b/src/lib/evas/filters/evas_filter_parser.c
@@ -663,6 +663,62 @@ _lua_buffer_tostring(lua_State *L)
}
static int
+_lua_buffer_index(lua_State *L)
+{
+ Buffer *buf, **pbuf;
+ const char *key;
+
+ pbuf = lua_touserdata(L, 1);
+ buf = pbuf ? *pbuf : NULL;
+ if (!buf) return 0;
+
+ key = lua_tostring(L, 2);
+ if (!key) return 0;
+
+ if (!strcmp(key, "width"))
+ {
+ lua_pushinteger(L, buf->w);
+ return 1;
+ }
+ else if (!strcmp(key, "height"))
+ {
+ lua_pushinteger(L, buf->h);
+ return 1;
+ }
+ else if (!strcmp(key, "type"))
+ {
+ lua_pushstring(L, buf->alpha ? "alpha" : "rgba");
+ return 1;
+ }
+ else if (!strcmp(key, "alpha"))
+ {
+ lua_pushboolean(L, buf->alpha);
+ return 1;
+ }
+ else if (!strcmp(key, "rgba"))
+ {
+ lua_pushboolean(L, !buf->alpha);
+ return 1;
+ }
+ else if (!strcmp(key, "name"))
+ {
+ lua_pushstring(L, buf->name);
+ return 1;
+ }
+ else if (!strcmp(key, "source"))
+ {
+ if (!buf->proxy) return 0;
+ lua_pushstring(L, buf->proxy);
+ return 1;
+ }
+ else
+ {
+ DBG("Unknown index '%s' for a buffer", key);
+ return 0;
+ }
+}
+
+static int
_lua_buffer_width(lua_State *L)
{
Buffer *buf, **pbuf;
@@ -2052,6 +2108,7 @@ static const luaL_Reg buffer_methods[] = {
static const luaL_Reg buffer_meta[] = {
{ "__tostring", _lua_buffer_tostring },
+ { "__index", _lua_buffer_index },
{ NULL, NULL }
};
@@ -2159,9 +2216,6 @@ _lua_state_create(Evas_Filter_Program *pgm)
luaL_openlib(L, _lua_buffer_meta, buffer_methods, 0);
luaL_newmetatable(L, _lua_buffer_meta);
luaL_openlib(L, NULL, buffer_meta, 0);
- lua_pushliteral(L, "__index");
- lua_pushvalue(L, -3);
- lua_rawset(L, -3);
lua_pushliteral(L, "__metatable");
lua_pushvalue(L, -3);
lua_rawset(L, -3);