summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_filter_mixin.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-06-22 21:52:16 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-25 14:36:09 +0900
commit0e8f890dfbdb188d02857b2bcf64d35089f3a297 (patch)
tree60211dde2c1da41adcd1612a700a7ba2854cd97a /src/lib/evas/canvas/evas_filter_mixin.c
parent84e3dd5c34f3ee7a8f07311eab6c950d1c76ea51 (diff)
Edje & evas filters: Add extra data from EDC to Lua program
This also supports color classes (really rough implementation for now, but the API should remain stable). @feature
Diffstat (limited to 'src/lib/evas/canvas/evas_filter_mixin.c')
-rw-r--r--src/lib/evas/canvas/evas_filter_mixin.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_filter_mixin.c b/src/lib/evas/canvas/evas_filter_mixin.c
index 87454a7..5a76b1e 100644
--- a/src/lib/evas/canvas/evas_filter_mixin.c
+++ b/src/lib/evas/canvas/evas_filter_mixin.c
@@ -123,6 +123,7 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
123 Evas_Filter_Program *pgm; 123 Evas_Filter_Program *pgm;
124 pgm = evas_filter_program_new(fcow->name, alpha); 124 pgm = evas_filter_program_new(fcow->name, alpha);
125 evas_filter_program_source_set_all(pgm, fcow->sources); 125 evas_filter_program_source_set_all(pgm, fcow->sources);
126 evas_filter_program_data_set_all(pgm, fcow->data);
126 evas_filter_program_state_set(pgm, eo_obj, obj, 127 evas_filter_program_state_set(pgm, eo_obj, obj,
127 fcow->state.cur.name, fcow->state.cur.value, 128 fcow->state.cur.name, fcow->state.cur.value,
128 fcow->state.next.name, fcow->state.next.value, 129 fcow->state.next.name, fcow->state.next.value,
@@ -274,6 +275,7 @@ _evas_filter_efl_gfx_filter_program_set(Eo *eo_obj, Evas_Filter_Data *pd,
274 alpha = eo_do_ret(eo_obj, alpha, evas_filter_input_alpha()); 275 alpha = eo_do_ret(eo_obj, alpha, evas_filter_input_alpha());
275 pgm = evas_filter_program_new(fcow->name, alpha); 276 pgm = evas_filter_program_new(fcow->name, alpha);
276 evas_filter_program_source_set_all(pgm, fcow->sources); 277 evas_filter_program_source_set_all(pgm, fcow->sources);
278 evas_filter_program_data_set_all(pgm, fcow->data);
277 evas_filter_program_state_set(pgm, eo_obj, obj, 279 evas_filter_program_state_set(pgm, eo_obj, obj,
278 fcow->state.cur.name, fcow->state.cur.value, 280 fcow->state.cur.name, fcow->state.cur.value,
279 fcow->state.next.name, fcow->state.next.value, 281 fcow->state.next.name, fcow->state.next.value,
@@ -377,6 +379,7 @@ _evas_filter_efl_gfx_filter_source_set(Eo *eo_obj, Evas_Filter_Data *pd,
377 379
378 eina_hash_add(fcow->sources, pb->name, pb); 380 eina_hash_add(fcow->sources, pb->name, pb);
379 evas_filter_program_source_set_all(fcow->chain, fcow->sources); 381 evas_filter_program_source_set_all(fcow->chain, fcow->sources);
382 evas_filter_program_data_set_all(fcow->chain, fcow->data);
380 383
381 // Update object 384 // Update object
382update: 385update:
@@ -497,9 +500,36 @@ _evas_filter_destructor(Eo *eo_obj, Evas_Filter_Data *pd)
497 if (pd->data->output) 500 if (pd->data->output)
498 ENFN->image_free(ENDT, pd->data->output); 501 ENFN->image_free(ENDT, pd->data->output);
499 eina_hash_free(pd->data->sources); 502 eina_hash_free(pd->data->sources);
503 eina_hash_free(pd->data->data);
500 evas_filter_program_del(pd->data->chain); 504 evas_filter_program_del(pd->data->chain);
501 eina_stringshare_del(pd->data->code); 505 eina_stringshare_del(pd->data->code);
502 eina_cow_free(evas_object_filter_cow, (const Eina_Cow_Data **) &pd->data); 506 eina_cow_free(evas_object_filter_cow, (const Eina_Cow_Data **) &pd->data);
503} 507}
504 508
509EOLIAN void
510_evas_filter_efl_gfx_filter_data_set(Eo *obj EINA_UNUSED, Evas_Filter_Data *pd,
511 const char *name, const char *value)
512{
513 const char *check = NULL;
514
515 if (!pd->data) return;
516
517 if (pd->data->data && ((check = eina_hash_find(pd->data->data, name)) != NULL))
518 {
519 if (!strcmp(check, value))
520 return;
521 }
522
523 EINA_COW_WRITE_BEGIN(evas_object_filter_cow, fcow, Evas_Object_Filter_Data, fcow)
524 {
525 if (!fcow->data)
526 fcow->data = eina_hash_string_small_new(free);
527 eina_hash_set(fcow->data, name, value ? strdup(value) : NULL);
528 if (fcow->chain)
529 evas_filter_program_data_set_all(fcow->chain, fcow->data);
530 fcow->changed = 1;
531 }
532 EINA_COW_WRITE_END(evas_object_filter_cow, fcow, fcow);
533}
534
505#include "evas_filter.eo.c" 535#include "evas_filter.eo.c"