Evas filters: Remove useless source_count and cow checks
This commit is contained in:
parent
b5ccb00ba7
commit
7db01ea396
|
@ -359,10 +359,12 @@ _evas_image_eo_base_constructor(Eo *eo_obj, Evas_Image_Data *o)
|
|||
cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
|
||||
if (cspace != o->cur->cspace)
|
||||
if (!o->cur->filter || (cspace != o->cur->cspace))
|
||||
{
|
||||
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
||||
state_write->cspace = cspace;
|
||||
if (!state_write->filter)
|
||||
state_write->filter = eina_cow_alloc(evas_object_filter_cow);
|
||||
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
||||
}
|
||||
}
|
||||
|
@ -3231,7 +3233,7 @@ start_draw:
|
|||
|
||||
if (!redraw && o->cur->filter->output)
|
||||
{
|
||||
if (o->cur->filter->sources && o->cur->filter->sources_count > 0)
|
||||
if (eina_hash_population(o->cur->filter->sources) > 0)
|
||||
{
|
||||
Evas_Filter_Proxy_Binding *pb;
|
||||
Evas_Object_Protected_Data *prxsource;
|
||||
|
@ -3780,7 +3782,7 @@ evas_object_image_render_pre(Evas_Object *eo_obj,
|
|||
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
||||
if (!o->pixels->pixel_updates) goto done;
|
||||
}
|
||||
if (o->cur->filter && o->cur->filter->changed)
|
||||
if (o->cur->filter->changed)
|
||||
{
|
||||
evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj);
|
||||
if (!o->pixels->pixel_updates) goto done;
|
||||
|
@ -4785,11 +4787,8 @@ _evas_image_filter_program_set(Eo *eo_obj, Evas_Image_Data *o, const char *arg)
|
|||
Evas_Filter_Program *pgm = NULL;
|
||||
|
||||
if (!o) return;
|
||||
if (o->cur->filter)
|
||||
{
|
||||
if (o->cur->filter->code == arg) return;
|
||||
if (o->cur->filter->code && arg && !strcmp(arg, o->cur->filter->code)) return;
|
||||
}
|
||||
if (o->cur->filter->code == arg) return;
|
||||
if (o->cur->filter->code && arg && !strcmp(arg, o->cur->filter->code)) return;
|
||||
|
||||
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
||||
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
||||
|
@ -4844,13 +4843,7 @@ _filter_source_hash_free_cb(void *data)
|
|||
|
||||
if (o && proxy)
|
||||
{
|
||||
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
||||
EINA_COW_IMAGE_FILTER_WRITE_BEGIN(state_write, fcow)
|
||||
fcow->sources_count--;
|
||||
EINA_COW_IMAGE_FILTER_WRITE_END(state_write, fcow)
|
||||
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write)
|
||||
|
||||
if (!o->cur->filter->sources_count)
|
||||
if (!eina_hash_population(o->cur->filter->sources))
|
||||
{
|
||||
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, proxy->proxy,
|
||||
Evas_Object_Proxy_Data, proxy_write)
|
||||
|
|
|
@ -33,7 +33,7 @@ static const Evas_Object_Protected_State default_state = {
|
|||
1.0, 0, EVAS_RENDER_BLEND, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE
|
||||
};
|
||||
static const Evas_Object_Filter_Data default_filter = {
|
||||
NULL, NULL, NULL, 0, NULL, EINA_FALSE, EINA_FALSE
|
||||
NULL, NULL, NULL, NULL, EINA_FALSE, EINA_FALSE
|
||||
};
|
||||
|
||||
Eina_Cow *evas_object_proxy_cow = NULL;
|
||||
|
|
|
@ -1542,23 +1542,17 @@ 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 filter output */
|
||||
if (o->cur.filter)
|
||||
{
|
||||
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
|
||||
{
|
||||
if (fcow->output)
|
||||
ENFN->image_free(ENDT, fcow->output);
|
||||
eina_hash_free(fcow->sources);
|
||||
evas_filter_program_del(fcow->chain);
|
||||
eina_stringshare_del(fcow->code);
|
||||
fcow->output = NULL;
|
||||
fcow->chain = NULL;
|
||||
fcow->sources = NULL;
|
||||
fcow->code = NULL;
|
||||
fcow->sources_count = 0;
|
||||
}
|
||||
EINA_COW_WRITE_END(evas_object_filter_cow, o->cur.filter, fcow);
|
||||
}
|
||||
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
|
||||
if (fcow->output)
|
||||
ENFN->image_free(ENDT, fcow->output);
|
||||
eina_hash_free(fcow->sources);
|
||||
evas_filter_program_del(fcow->chain);
|
||||
eina_stringshare_del(fcow->code);
|
||||
fcow->output = NULL;
|
||||
fcow->chain = NULL;
|
||||
fcow->sources = NULL;
|
||||
fcow->code = NULL;
|
||||
EINA_COW_WRITE_END(evas_object_filter_cow, o->cur.filter, fcow);
|
||||
|
||||
/* free obj */
|
||||
_evas_object_text_items_clear(o);
|
||||
|
@ -1646,7 +1640,7 @@ evas_object_text_render(Evas_Object *eo_obj,
|
|||
int shad_dst = 0, shad_sz = 0, dx = 0, dy = 0, haveshad = 0;
|
||||
|
||||
/* render object to surface with context, and offxet by x,y */
|
||||
if (!o->cur.filter || !o->cur.filter->chain)
|
||||
if (!o->cur.filter->chain)
|
||||
evas_text_style_pad_get(o->cur.style, &sl, NULL, &st, NULL);
|
||||
else
|
||||
evas_filter_program_padding_get(o->cur.filter->chain, &sl, NULL, &st, NULL);
|
||||
|
@ -1731,8 +1725,7 @@ evas_object_text_render(Evas_Object *eo_obj,
|
|||
* remotely similar to its final form. You've been warned :)
|
||||
*/
|
||||
|
||||
if (o->cur.filter &&
|
||||
(!o->cur.filter->invalid && (o->cur.filter->chain || o->cur.filter->code)))
|
||||
if (!o->cur.filter->invalid && (o->cur.filter->chain || o->cur.filter->code))
|
||||
{
|
||||
int X, Y, W, H;
|
||||
Evas_Filter_Context *filter;
|
||||
|
@ -2317,7 +2310,7 @@ _evas_object_text_recalc(Evas_Object *eo_obj, Eina_Unicode *text)
|
|||
|
||||
w = _evas_object_text_horiz_advance_without_ellipsis_get(o);
|
||||
h = _evas_object_text_vert_advance_get(eo_obj, o);
|
||||
if (!o->cur.filter || !o->cur.filter->chain)
|
||||
if (!o->cur.filter->chain)
|
||||
evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b);
|
||||
else
|
||||
evas_filter_program_padding_get(o->cur.filter->chain, &l, &r, &t, &b);
|
||||
|
@ -2341,7 +2334,7 @@ _evas_object_text_recalc(Evas_Object *eo_obj, Eina_Unicode *text)
|
|||
{
|
||||
int t = 0, b = 0, l = 0, r = 0;
|
||||
|
||||
if (!o->cur.filter || !o->cur.filter->chain)
|
||||
if (!o->cur.filter->chain)
|
||||
evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b);
|
||||
else
|
||||
evas_filter_program_padding_get(o->cur.filter->chain, &l, &r, &t, &b);
|
||||
|
@ -2363,11 +2356,8 @@ _evas_text_filter_program_set(Eo *eo_obj, Evas_Text_Data *o, const char *arg)
|
|||
Evas_Filter_Program *pgm = NULL;
|
||||
|
||||
if (!o) return;
|
||||
if (o->cur.filter)
|
||||
{
|
||||
if (o->cur.filter->code == arg) return;
|
||||
if (o->cur.filter->code && arg && !strcmp(arg, o->cur.filter->code)) return;
|
||||
}
|
||||
if (o->cur.filter->code == arg) return;
|
||||
if (o->cur.filter->code && arg && !strcmp(arg, o->cur.filter->code)) return;
|
||||
|
||||
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
|
||||
{
|
||||
|
@ -2424,11 +2414,7 @@ _filter_source_hash_free_cb(void *data)
|
|||
|
||||
if (o && proxy)
|
||||
{
|
||||
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
|
||||
fcow->sources_count--;
|
||||
EINA_COW_WRITE_END(evas_object_filter_cow, o->cur.filter, fcow);
|
||||
|
||||
if (!o->cur.filter->sources_count)
|
||||
if (!eina_hash_population(o->cur.filter->sources))
|
||||
{
|
||||
EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, proxy->proxy,
|
||||
Evas_Object_Proxy_Data, proxy_write)
|
||||
|
@ -2454,13 +2440,13 @@ _evas_text_filter_source_set(Eo *eo_obj, Evas_Text_Data *o, const char *name, Ev
|
|||
|
||||
if (!name)
|
||||
{
|
||||
if (!eo_source || !o->cur.filter || !o->cur.filter->sources) return;
|
||||
if (!eo_source || !o->cur.filter->sources) return;
|
||||
if (eina_hash_del_by_data(o->cur.filter->sources, eo_source))
|
||||
goto update;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source && (!o->cur.filter || !o->cur.filter->sources))
|
||||
if (!source && !o->cur.filter->sources)
|
||||
return;
|
||||
|
||||
fcow = eina_cow_write(evas_object_filter_cow, (const Eina_Cow_Data**)&o->cur.filter);
|
||||
|
@ -2510,8 +2496,6 @@ _evas_text_filter_source_set(Eo *eo_obj, Evas_Text_Data *o, const char *name, Ev
|
|||
EINA_COW_WRITE_END(evas_object_proxy_cow, obj->proxy, proxy_write)
|
||||
|
||||
eina_hash_add(fcow->sources, pb->name, pb);
|
||||
fcow->sources_count++;
|
||||
|
||||
evas_filter_program_source_set_all(fcow->chain, fcow->sources);
|
||||
|
||||
// Update object
|
||||
|
|
|
@ -1082,7 +1082,6 @@ struct _Evas_Object_Filter_Data
|
|||
Eina_Stringshare *code;
|
||||
Evas_Filter_Program *chain;
|
||||
Eina_Hash *sources; // Evas_Filter_Proxy_Binding
|
||||
int sources_count;
|
||||
void *output;
|
||||
Eina_Bool changed : 1;
|
||||
Eina_Bool invalid : 1; // Code parse failed
|
||||
|
|
Loading…
Reference in New Issue