summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2020-01-21 19:28:59 +0900
committerShinwoo Kim <cinoo.kim@samsung.com>2020-01-21 19:29:37 +0900
commit7311b6fe323e00e9636676f9e7ae658167998dc3 (patch)
tree7c310801a46651fcb53324fbfb174eabc6185cdf
parenta49e3ad7e3843a85743bcb49ddd0632bf3155ccf (diff)
downloadefl-7311b6fe323e00e9636676f9e7ae658167998dc3.tar.gz
Efl.Canvas.Group: implement Efl.Gfx.Filter
Summary: This patch makes Efl.Canvas.Group work for Efl.Gfx.Filter Reviewers: Hermet, jsuya, zmike Reviewed By: Hermet Subscribers: zmike, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10435
-rw-r--r--src/lib/evas/canvas/efl_canvas_group.eo4
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c53
-rw-r--r--src/lib/evas/canvas/evas_render.c7
-rw-r--r--src/lib/evas/include/evas_private.h1
4 files changed, 64 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_group.eo b/src/lib/evas/canvas/efl_canvas_group.eo
index 500b521f88..31105a0fc6 100644
--- a/src/lib/evas/canvas/efl_canvas_group.eo
+++ b/src/lib/evas/canvas/efl_canvas_group.eo
@@ -1,4 +1,4 @@
-class Efl.Canvas.Group extends Efl.Canvas.Object
+class Efl.Canvas.Group extends Efl.Canvas.Object implements Efl.Gfx.Filter
{
[[A group object is a container for other canvas objects. Its children
move along their parent and are often clipped with a common clipper.
@@ -127,6 +127,8 @@ class Efl.Canvas.Group extends Efl.Canvas.Object
Efl.Gfx.Color.color { set; }
Efl.Gfx.Entity.visible { set; }
Efl.Gfx.Entity.position { set; }
+ Efl.Gfx.Entity.size { set; }
+ Efl.Gfx.Filter.filter_program { set; }
Efl.Canvas.Object.clipper { set; }
Efl.Canvas.Object.no_render { set; }
Efl.Canvas.Object.paragraph_direction { get; set; }
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index 7f07d826e3..0af4fb5ad6 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -23,6 +23,7 @@ struct _Evas_Smart_Data
Eina_Rectangle bounding_box;
} cur, prev;
Evas_Object *object;
+ Evas_Object *filter_img;
void *engine_data;
void *data;
Eina_Inlist *callbacks;
@@ -909,6 +910,9 @@ _efl_canvas_group_efl_gfx_entity_visible_set(Eo *eo_obj, Evas_Smart_Data *o, Ein
efl_gfx_entity_visible_set(clipper, vis);
}
+
+ if (o->filter_img)
+ efl_gfx_entity_visible_set(o->filter_img, vis);
}
EOLIAN static void
@@ -927,6 +931,55 @@ _efl_canvas_group_efl_gfx_entity_position_set(Eo *eo_obj, Evas_Smart_Data *o, Ei
if (o->clipped && !is_overridden)
_evas_object_smart_clipped_smart_move_internal(eo_obj, pos.x, pos.y);
efl_gfx_entity_position_set(efl_super(eo_obj, MY_CLASS), pos);
+ efl_gfx_entity_position_set(o->filter_img, pos);
+}
+
+EOLIAN static void
+_efl_canvas_group_efl_gfx_entity_size_set(Eo *obj, Evas_Smart_Data *o, Eina_Size2D size)
+{
+ if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h))
+ return;
+
+ efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size);
+ efl_gfx_entity_size_set(o->filter_img, size);
+}
+
+EOLIAN static void
+_efl_canvas_group_efl_gfx_filter_filter_program_set(Eo *eo_obj, Evas_Smart_Data *o,
+ const char *code, const char *name)
+{
+ Evas_Object_Protected_Data *obj, *fobj;
+ obj = EVAS_OBJ_GET_OR_RETURN(eo_obj);
+
+ if (!code && !name)
+ {
+ if (o->filter_img)
+ {
+ evas_object_del(o->filter_img);
+ o->filter_img = NULL;
+ }
+ return;
+ }
+
+ if (o->filter_img)
+ {
+ efl_gfx_filter_program_set(o->filter_img, code, name);
+ return;
+ }
+
+ o->filter_img = efl_add(EFL_CANVAS_PROXY_CLASS, eo_obj,
+ efl_gfx_fill_auto_set(efl_added, EINA_TRUE),
+ efl_canvas_group_member_add(obj->object, efl_added),
+ efl_canvas_proxy_source_events_set(efl_added, EINA_TRUE),
+ efl_canvas_proxy_source_set(efl_added, eo_obj),
+ evas_object_repeat_events_set(efl_added, EINA_TRUE),
+ efl_gfx_filter_program_set(efl_added, code, name),
+ efl_gfx_entity_geometry_set(efl_added, (Eina_Rect)obj->cur->geometry),
+ efl_gfx_entity_visible_set(efl_added, obj->cur->visible));
+
+ fobj = efl_data_scope_get(o->filter_img, EFL_CANVAS_OBJECT_CLASS);
+ if (!fobj) return;
+ fobj->is_filter_object = EINA_TRUE;
}
EOLIAN static void
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 70ed55a953..d655bbdc27 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -2170,6 +2170,13 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj,
EINA_INLIST_FOREACH
(evas_object_smart_members_get_direct(eo_obj), obj2)
{
+ /* skip proxy object if its source is its smart parent.
+ who makes this relation? a proxy object working for
+ a smart object to set a filter program. the proxy
+ object should be a member of smart object to sync
+ stacking changes. */
+ if (obj2->is_filter_object) continue;
+
clean_them |= evas_render_mapped(evas, obj2->object,
obj2, ctx,
output, surface,
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 51f4ce22bd..e7de463987 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1228,6 +1228,7 @@ struct _Evas_Object_Protected_Data
Eina_Bool events_filter_enabled : 1;
Eina_Bool is_pointer_inside_legacy : 1;
+ Eina_Bool is_filter_object : 1;
};
struct _Evas_Data_Node