summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-10-29 15:10:03 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-10-29 15:12:53 +0900
commit251389fefd6df762e9369e5b389c62c4bb1d481f (patch)
tree86d28b89c7e69b824467571eeb4a24308d5bc0f8 /src/lib/evas/canvas
parentf3226f5e815c5bbbe070fd921b958aaa56a385df (diff)
Evas filters: Fix COW usage.
Thanks cedric for the report. We'll need a new function (after 1.12) to detect if the current cow pointer is the default data or not. Maybe eina_cow_default_get() or maybe something just returning a bool.
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r--src/lib/evas/canvas/evas_object_main.c1
-rw-r--r--src/lib/evas/canvas/evas_object_text.c29
2 files changed, 18 insertions, 12 deletions
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index fded1ceee6..ac1f53eac2 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -35,6 +35,7 @@ static const Evas_Object_Protected_State default_state = {
35static const Evas_Object_Filter_Data default_filter = { 35static const Evas_Object_Filter_Data default_filter = {
36 NULL, NULL, NULL, NULL, EINA_FALSE, EINA_FALSE 36 NULL, NULL, NULL, NULL, EINA_FALSE, EINA_FALSE
37}; 37};
38const void * const evas_object_filter_cow_default = &default_filter;
38 39
39Eina_Cow *evas_object_proxy_cow = NULL; 40Eina_Cow *evas_object_proxy_cow = NULL;
40Eina_Cow *evas_object_map_cow = NULL; 41Eina_Cow *evas_object_map_cow = NULL;
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 3cf8df3242..8eadf07f17 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -403,7 +403,8 @@ _evas_text_efl_text_properties_font_source_get(Eo *eo_obj EINA_UNUSED, Evas_Text
403static inline void 403static inline void
404_evas_text_filter_changed_set(Evas_Text_Data *o, Eina_Bool val) 404_evas_text_filter_changed_set(Evas_Text_Data *o, Eina_Bool val)
405{ 405{
406 if (o->cur.filter && (o->cur.filter->changed != val)) 406 if ((evas_object_filter_cow_default != o->cur.filter)
407 && (o->cur.filter->changed != val))
407 { 408 {
408 EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow) 409 EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
409 fcow->changed = val; 410 fcow->changed = val;
@@ -1542,17 +1543,21 @@ evas_object_text_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1542 Evas_Text_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); 1543 Evas_Text_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
1543 1544
1544 /* free filter output */ 1545 /* free filter output */
1545 EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow) 1546 if (evas_object_filter_cow_default != o->cur.filter)
1546 if (fcow->output) 1547 {
1547 ENFN->image_free(ENDT, fcow->output); 1548 EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
1548 eina_hash_free(fcow->sources); 1549 if (fcow->output)
1549 evas_filter_program_del(fcow->chain); 1550 ENFN->image_free(ENDT, fcow->output);
1550 eina_stringshare_del(fcow->code); 1551 eina_hash_free(fcow->sources);
1551 fcow->output = NULL; 1552 evas_filter_program_del(fcow->chain);
1552 fcow->chain = NULL; 1553 eina_stringshare_del(fcow->code);
1553 fcow->sources = NULL; 1554 fcow->output = NULL;
1554 fcow->code = NULL; 1555 fcow->chain = NULL;
1555 EINA_COW_WRITE_END(evas_object_filter_cow, o->cur.filter, fcow); 1556 fcow->sources = NULL;
1557 fcow->code = NULL;
1558 EINA_COW_WRITE_END(evas_object_filter_cow, o->cur.filter, fcow);
1559 eina_cow_free(evas_object_filter_cow, (const Eina_Cow_Data **) &o->cur.filter);
1560 }
1556 1561
1557 /* free obj */ 1562 /* free obj */
1558 _evas_object_text_items_clear(o); 1563 _evas_object_text_items_clear(o);