Evas filters: Rename bind to source_set

Because that's what we call it for proxy images :)
This commit is contained in:
Jean-Philippe Andre 2014-02-05 11:40:10 +09:00
parent 7043c8bb89
commit 8570b38dd1
6 changed files with 56 additions and 21 deletions

View File

@ -1847,7 +1847,7 @@ enum
EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_SET,
EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_GET,
EVAS_OBJ_TEXT_SUB_ID_FILTER_PROGRAM_SET,
EVAS_OBJ_TEXT_SUB_ID_FILTER_OBJECT_BIND,
EVAS_OBJ_TEXT_SUB_ID_FILTER_SOURCE_SET,
EVAS_OBJ_TEXT_SUB_ID_LAST
};
@ -2281,11 +2281,17 @@ enum
#define evas_obj_text_filter_program_set(str) EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FILTER_PROGRAM_SET), EO_TYPECHECK(const char *, str)
/**
* @def evas_obj_text_filter_object_bind
* @since 1.9
* @note EXPERIMENTAL code
*
* Bind an object to use as a mask or texture in special filter
*
* @param[in] name Object name as used in the program code
* @param[in] obj Eo object to use through proxy rendering
*
* @see evas_obj_text_filter_program_set
*
* @note EXPERIMENTAL FEATURE.
*/
#define evas_obj_text_filter_object_bind(str, prxy) EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FILTER_OBJECT_BIND), EO_TYPECHECK(const char *, str), EO_TYPECHECK(Eo *, prxy)
#define evas_obj_text_filter_source_set(name, obj) EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FILTER_SOURCE_SET), EO_TYPECHECK(const char *, name), EO_TYPECHECK(Eo *, obj)
/**
* @}

View File

@ -2227,11 +2227,10 @@ evas_object_text_render(Evas_Object *eo_obj EINA_UNUSED,
evas_filter_run(filter);
o->cur.filter.changed = EINA_FALSE;
INF("Effect rendering done. Return.");
DBG("Effect rendering done.");
return;
}
/* End of the EXPERIMENTAL code */
normal_render:
@ -2703,7 +2702,7 @@ _filter_program_set(Eo *eo_obj, void *_pd, va_list *list)
if (arg)
{
pgm = evas_filter_program_new("Evas_Text: Filter Program");
evas_filter_program_proxy_source_bind_all(pgm, o->cur.filter.sources);
evas_filter_program_source_set_all(pgm, o->cur.filter.sources);
if (!evas_filter_program_parse(pgm, arg))
{
ERR("Parsing failed!");
@ -2726,7 +2725,7 @@ _filter_program_set(Eo *eo_obj, void *_pd, va_list *list)
}
static void
_filter_object_bind(Eo *eo_obj, void *_pd, va_list *list)
_filter_source_set(Eo *eo_obj, void *_pd, va_list *list)
{
Evas_Object_Text *o = _pd;
Evas_Object_Protected_Data *obj;
@ -2749,7 +2748,7 @@ _filter_object_bind(Eo *eo_obj, void *_pd, va_list *list)
return;
}
evas_filter_program_proxy_source_bind(pgm, name, proxy);
evas_filter_program_source_set(pgm, name, proxy);
o->cur.filter.changed = EINA_TRUE;
// Update object
@ -2806,7 +2805,7 @@ _class_constructor(Eo_Class *klass)
EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_SET), _text_ellipsis_set),
EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_GET), _text_ellipsis_get),
EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FILTER_PROGRAM_SET), _filter_program_set),
EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FILTER_OBJECT_BIND), _filter_object_bind),
EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FILTER_SOURCE_SET), _filter_source_set),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
@ -2845,7 +2844,7 @@ static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_SET, "Gets the ellipsis of a text object."),
EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_GET, "Sets the ellipsis of a text object."),
EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_FILTER_PROGRAM_SET, "Text special effects: Set the style program (string)."),
EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_FILTER_OBJECT_BIND, "Text special effects: Bind an Evas_Object to a name for proxy rendering."),
EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_FILTER_SOURCE_SET, "Text special effects: Bind an Evas_Object to a name for proxy rendering."),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {

View File

@ -122,7 +122,7 @@ _filter_buffer_backing_free(Evas_Filter_Buffer *fb)
/** @hidden private bind proxy to context */
void
evas_filter_context_proxy_bind(Evas_Filter_Context *ctx, Evas_Object *eo_proxy,
evas_filter_context_source_set(Evas_Filter_Context *ctx, Evas_Object *eo_proxy,
Evas_Object *eo_source, int bufid,
Eina_Stringshare *name)
{

View File

@ -1380,8 +1380,8 @@ evas_filter_program_new(const char *name)
/** Bind an object for proxy rendering */
void
evas_filter_program_proxy_source_bind(Evas_Filter_Program *pgm,
const char *name, Evas_Object *object)
evas_filter_program_source_set(Evas_Filter_Program *pgm,
const char *name, Evas_Object *object)
{
Evas_Object *old;
@ -1392,10 +1392,39 @@ evas_filter_program_proxy_source_bind(Evas_Filter_Program *pgm,
eina_hash_add(pgm->proxies, name, object);
}
void
evas_filter_program_source_set_all(Evas_Filter_Program *pgm,
Eina_Hash *proxies)
{
Eina_Hash_Tuple *tuple;
Eina_Iterator *it;
Evas_Object *old;
if (!pgm || !proxies) return;
it = eina_hash_iterator_tuple_new(proxies);
EINA_ITERATOR_FOREACH(it, tuple)
{
Eina_Stringshare *name = tuple->key;
Eo *source = tuple->data;
old = eina_hash_find(pgm->proxies, name);
if (old)
{
INF("Buffer %s already exists, skipping proxy source.", name);
continue;
}
INF("Binding object %p as '%s'", source, name);
evas_filter_program_source_set(pgm, name, source);
}
eina_iterator_free(it);
}
/** Get object used for proxy rendering */
Evas_Object *
evas_filter_program_proxy_source_get(Evas_Filter_Program *pgm, const char *name)
evas_filter_program_source_get(Evas_Filter_Program *pgm, const char *name)
{
return (Evas_Object *) eina_hash_find(pgm->proxies, name);
}
@ -1838,8 +1867,8 @@ evas_filter_context_program_use(Evas_Filter_Context *ctx, Evas_Object *eo_obj,
buf->cid = evas_filter_buffer_empty_new(ctx, buf->alpha);
if (buf->proxy)
{
Eo *eo_source = evas_filter_program_proxy_source_get(pgm, buf->proxy);
evas_filter_context_proxy_bind(ctx, eo_obj, eo_source, buf->cid, buf->proxy);
Eo *eo_source = evas_filter_program_source_get(pgm, buf->proxy);
evas_filter_context_source_set(ctx, eo_obj, eo_source, buf->cid, buf->proxy);
}
}

View File

@ -167,7 +167,7 @@ enum _Evas_Filter_Interpolation_Mode
};
void evas_filter_context_clear(Evas_Filter_Context *ctx);
void evas_filter_context_proxy_bind(Evas_Filter_Context *ctx, Evas_Object *eo_proxy, Evas_Object *eo_source, int bufid, Eina_Stringshare *name);
void evas_filter_context_source_set(Evas_Filter_Context *ctx, Evas_Object *eo_proxy, Evas_Object *eo_source, int bufid, Eina_Stringshare *name);
/* FIXME: CPU filters entry points. Move these to the Evas Engine itself. */
Evas_Filter_Apply_Func evas_filter_blend_cpu_func_get(Evas_Filter_Command *cmd);

View File

@ -95,8 +95,9 @@ Eina_Bool evas_filter_program_parse(Evas_Filter_Program *pgm, con
void evas_filter_program_del(Evas_Filter_Program *pgm);
Eina_Bool evas_filter_context_program_use(Evas_Filter_Context *ctx, Evas_Object *eo_obj, Evas_Filter_Program *pgm);
Eina_Bool evas_filter_program_padding_get(Evas_Filter_Program *pgm, int *l, int *r, int *t, int *b);
void evas_filter_program_proxy_source_bind(Evas_Filter_Program *pgm, const char *name, Evas_Object *object);
Evas_Object *evas_filter_program_proxy_source_get(Evas_Filter_Program *pgm, const char *name);
void evas_filter_program_source_set(Evas_Filter_Program *pgm, const char *name, Evas_Object *object);
void evas_filter_program_source_set_all(Evas_Filter_Program *pgm, Eina_Hash *sources);
Evas_Object *evas_filter_program_source_get(Evas_Filter_Program *pgm, const char *name);
void evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx, Eo *eo_obj, Eina_Bool do_async);
/* Filter context (low level) */