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.
This commit is contained in:
Jean-Philippe Andre 2016-02-26 18:24:47 +09:00
parent 675a263f97
commit 17e3f8c1a6
4 changed files with 17 additions and 26 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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);