From: Jean-Philippe Andre Date: Fri, 26 Feb 2016 09:24:47 +0000 (+0900) Subject: Evas Filter: Use Eo.Base.constructor in the mixin X-Git-Tag: upstream/1.20.0~7365 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17e3f8c1a675d0848763b9d8d790530087dccd21;p=platform%2Fupstream%2Fefl.git Evas Filter: Use Eo.Base.constructor in the mixin This is made possible by inheriting first from an interface instead of Eo.Base, thus implementing the Eo.Base interface. --- diff --git a/src/lib/evas/canvas/evas_filter.eo b/src/lib/evas/canvas/evas_filter.eo index 85699b5..18a4d28 100644 --- a/src/lib/evas/canvas/evas_filter.eo +++ b/src/lib/evas/canvas/evas_filter.eo @@ -1,4 +1,4 @@ -mixin Evas.Filter (Efl.Gfx.Filter) +mixin Evas.Filter (Efl.Gfx.Filter, Eo.Base) { // Evas internal implementation legacy_prefix: null; @@ -19,19 +19,6 @@ mixin Evas.Filter (Efl.Gfx.Filter) val: bool; } } - ctor @protected { - [[Initialize the Evas.Filter mixin. - - Should be called in a parent's class constructor. - ]] - } - dtor @protected { - [[Release all data held by this Evas.Filter. - - This may include image buffers allocated by the Evas engine. - This should be called at the beginning of a parent's class destructor. - ]] - } input_alpha @protected { [[Called by Evas.Filter to determine whether the input is alpha or rgba.]] return: bool; @@ -70,6 +57,8 @@ mixin Evas.Filter (Efl.Gfx.Filter) } } implements { + Eo.Base.constructor; + Eo.Base.destructor; Efl.Gfx.Filter.program.set; Efl.Gfx.Filter.program.get; Efl.Gfx.Filter.state.set; diff --git a/src/lib/evas/canvas/evas_filter_mixin.c b/src/lib/evas/canvas/evas_filter_mixin.c index 664cf15..428696a 100644 --- a/src/lib/evas/canvas/evas_filter_mixin.c +++ b/src/lib/evas/canvas/evas_filter_mixin.c @@ -583,22 +583,27 @@ _evas_filter_invalid_set(Eo *eo_obj EINA_UNUSED, Evas_Filter_Data *pd, Eina_Bool } } -EOLIAN static void -_evas_filter_ctor(Eo *eo_obj EINA_UNUSED, Evas_Filter_Data *pd) +EOLIAN static Eo_Base * +_evas_filter_eo_base_constructor(Eo *eo_obj, Evas_Filter_Data *pd) { + Eo *obj = NULL; + + eo_do_super(eo_obj, MY_CLASS, obj = eo_constructor()); pd->data = eina_cow_alloc(evas_object_filter_cow); SLKI(pd->lck); + + return obj; } EOLIAN static void -_evas_filter_dtor(Eo *eo_obj, Evas_Filter_Data *pd) +_evas_filter_eo_base_destructor(Eo *eo_obj, Evas_Filter_Data *pd) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); Evas_Filter_Data_Binding *db; Eina_Inlist *il; - if (!pd->data) return; - if (evas_object_filter_cow_default == pd->data) return; + if (!pd->data || (evas_object_filter_cow_default == pd->data)) + goto finish; if (pd->data->output) { @@ -616,6 +621,8 @@ _evas_filter_dtor(Eo *eo_obj, Evas_Filter_Data *pd) } evas_filter_program_del(pd->data->chain); eina_stringshare_del(pd->data->code); + +finish: eina_cow_free(evas_object_filter_cow, (const Eina_Cow_Data **) &pd->data); if (pd->has_cb) { @@ -624,6 +631,8 @@ _evas_filter_dtor(Eo *eo_obj, Evas_Filter_Data *pd) _render_post_cb, eo_obj)); } SLKD(pd->lck); + + eo_do_super(eo_obj, MY_CLASS, eo_destructor()); } EOLIAN static void diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index dfeda99..474386f 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -371,8 +371,6 @@ _evas_image_eo_base_constructor(Eo *eo_obj, Evas_Image_Data *o) EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); } - eo_do(eo_obj, evas_filter_ctor()); - return eo_obj; } @@ -3030,8 +3028,6 @@ evas_object_image_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) } EINA_COW_PIXEL_WRITE_END(o, pixi_write); } - - eo_do(eo_obj, evas_filter_dtor()); } static void diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c index d6d3ee5..28e756c 100644 --- a/src/lib/evas/canvas/evas_object_text.c +++ b/src/lib/evas/canvas/evas_object_text.c @@ -1603,8 +1603,6 @@ evas_object_text_init(Evas_Object *eo_obj) o->bidi_par_props = evas_bidi_paragraph_props_new(); o->inherit_paragraph_direction = EINA_TRUE; #endif - - eo_do(eo_obj, evas_filter_ctor()); } EOLIAN static void @@ -1621,7 +1619,6 @@ evas_object_text_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) Evas_Text_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); /* free obj */ - eo_do(eo_obj, evas_filter_dtor()); _evas_object_text_items_clear(o); if (o->cur.utf8_text) eina_stringshare_del(o->cur.utf8_text); if (o->cur.font) eina_stringshare_del(o->cur.font);