cedric pushed a commit to branch master.
commit 85f0749a83a2d1eeb474d92de077d484aa195b64
Author: Cedric Bail <[email protected]>
Date: Thu Aug 29 10:53:48 2013 +0900
evas: cleanup intercept code and improve performance there a little.
---
src/lib/evas/canvas/evas_clip.c | 2 +-
src/lib/evas/canvas/evas_layer.c | 2 +-
src/lib/evas/canvas/evas_object_intercept.c | 204 ++++++++++------------------
src/lib/evas/canvas/evas_object_main.c | 8 +-
src/lib/evas/canvas/evas_stack.c | 20 +--
5 files changed, 90 insertions(+), 146 deletions(-)
diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c
index 0d3999e..70134eb 100644
--- a/src/lib/evas/canvas/evas_clip.c
+++ b/src/lib/evas/canvas/evas_clip.c
@@ -374,7 +374,7 @@ _clip_unset(Eo *eo_obj, void *_pd, va_list *list
EINA_UNUSED)
obj->clip.cache_clipees_answer =
eina_list_free(obj->clip.cache_clipees_answer);
/* unclip */
- if (evas_object_intercept_call_clip_unset(eo_obj)) return;
+ if (evas_object_intercept_call_clip_unset(eo_obj, obj)) return;
if (obj->is_smart)
{
eo_do(eo_obj, evas_obj_smart_clip_unset());
diff --git a/src/lib/evas/canvas/evas_layer.c b/src/lib/evas/canvas/evas_layer.c
index 2484d6c..3c2a622 100644
--- a/src/lib/evas/canvas/evas_layer.c
+++ b/src/lib/evas/canvas/evas_layer.c
@@ -193,7 +193,7 @@ _layer_set(Eo *eo_obj, void *_obj, va_list *list)
Evas_Object_Protected_Data *obj = _obj;
if (obj->delete_me) return;
- if (evas_object_intercept_call_layer_set(eo_obj, l)) return;
+ if (evas_object_intercept_call_layer_set(eo_obj, obj, l)) return;
if (obj->smart.parent) return;
if (obj->cur->layer == l)
{
diff --git a/src/lib/evas/canvas/evas_object_intercept.c
b/src/lib/evas/canvas/evas_object_intercept.c
index 7bf6954..ff3d5c1 100644
--- a/src/lib/evas/canvas/evas_object_intercept.c
+++ b/src/lib/evas/canvas/evas_object_intercept.c
@@ -45,137 +45,77 @@ evas_object_intercept_cleanup(Evas_Object *eo_obj)
if (obj->interceptors) free(obj->interceptors);
}
-int
-evas_object_intercept_call_show(Evas_Object *eo_obj)
-{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->show.func);
- if (ret)
- obj->interceptors->show.func(obj->interceptors->show.data, eo_obj);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
+#define EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(Type) \
+ int \
+ evas_object_intercept_call_##Type(Evas_Object *eo_obj, \
+ Evas_Object_Protected_Data *obj) \
+ { \
+ int ret; \
+ \
+ if (!obj->interceptors) return 0; \
+ if (obj->intercepted) return 0; \
+ obj->intercepted = EINA_TRUE; \
+ ret = !!(obj->interceptors->Type.func); \
+ if (ret) \
+ obj->interceptors->Type.func(obj->interceptors->Type.data, eo_obj); \
+ obj->intercepted = EINA_FALSE; \
+ return ret; \
+ }
+
+EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(show);
+EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(hide);
+EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(raise);
+EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(lower);
+
+#define EVAS_OBJECT_INTERCEPT_CALL_GEOMETRY(Type) \
+ int \
+ evas_object_intercept_call_##Type(Evas_Object *eo_obj, \
+ Evas_Object_Protected_Data *obj, \
+ Evas_Coord a, Evas_Coord b) \
+ { \
+ int ret; \
+ \
+ if (!obj->interceptors) return 0; \
+ if (obj->intercepted) return 0; \
+ obj->intercepted = EINA_TRUE; \
+ ret = !!(obj->interceptors->Type.func); \
+ if (ret) \
+ obj->interceptors->Type.func(obj->interceptors->Type.data, \
+ eo_obj, a , b); \
+ obj->intercepted = EINA_FALSE; \
+ return ret; \
+ }
+
+EVAS_OBJECT_INTERCEPT_CALL_GEOMETRY(move);
+EVAS_OBJECT_INTERCEPT_CALL_GEOMETRY(resize);
+
+#define EVAS_OBJECT_INTERCEPT_CALL_STACKING(Type) \
+ int \
+ evas_object_intercept_call_##Type(Evas_Object *eo_obj, \
+ Evas_Object_Protected_Data *obj, \
+ Evas_Object *rel_to) \
+ { \
+ int ret; \
+ \
+ if (!obj->interceptors) return 0; \
+ if (obj->intercepted) return 0; \
+ obj->intercepted = EINA_TRUE; \
+ ret = !!(obj->interceptors->Type.func); \
+ if (ret) \
+ obj->interceptors->Type.func(obj->interceptors->Type.data, \
+ eo_obj, rel_to); \
+ obj->intercepted = EINA_FALSE; \
+ return ret; \
+ }
+
+EVAS_OBJECT_INTERCEPT_CALL_STACKING(stack_above);
+EVAS_OBJECT_INTERCEPT_CALL_STACKING(stack_below);
int
-evas_object_intercept_call_hide(Evas_Object *eo_obj)
+evas_object_intercept_call_layer_set(Evas_Object *eo_obj,
+ Evas_Object_Protected_Data *obj,
+ int l)
{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->hide.func);
- if (ret)
- obj->interceptors->hide.func(obj->interceptors->hide.data, eo_obj);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
-
-int
-evas_object_intercept_call_move(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj, Evas_Coord x, Evas_Coord y)
-{
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->move.func);
- if (ret)
- obj->interceptors->move.func(obj->interceptors->move.data, eo_obj, x, y);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
-
-int
-evas_object_intercept_call_resize(Evas_Object *eo_obj, Evas_Coord w,
Evas_Coord h)
-{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->resize.func);
- if (ret)
- obj->interceptors->resize.func(obj->interceptors->resize.data, eo_obj, w,
h);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
-
-int
-evas_object_intercept_call_raise(Evas_Object *eo_obj)
-{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->raise.func);
- if (ret)
- obj->interceptors->raise.func(obj->interceptors->raise.data, eo_obj);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
-
-int
-evas_object_intercept_call_lower(Evas_Object *eo_obj)
-{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->lower.func);
- if (ret)
- obj->interceptors->lower.func(obj->interceptors->lower.data, eo_obj);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
-
-int
-evas_object_intercept_call_stack_above(Evas_Object *eo_obj, Evas_Object *above)
-{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->stack_above.func);
- if (ret)
- obj->interceptors->stack_above.func(obj->interceptors->stack_above.data,
eo_obj, above);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
-
-int
-evas_object_intercept_call_stack_below(Evas_Object *eo_obj, Evas_Object *below)
-{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
- int ret;
-
- if (!obj->interceptors) return 0;
- if (obj->intercepted) return 0;
- obj->intercepted = EINA_TRUE;
- ret = !!(obj->interceptors->stack_below.func);
- if (ret)
- obj->interceptors->stack_below.func(obj->interceptors->stack_below.data,
eo_obj, below);
- obj->intercepted = EINA_FALSE;
- return ret;
-}
-
-int
-evas_object_intercept_call_layer_set(Evas_Object *eo_obj, int l)
-{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
int ret;
if (!obj->interceptors) return 0;
@@ -189,9 +129,10 @@ evas_object_intercept_call_layer_set(Evas_Object *eo_obj,
int l)
}
int
-evas_object_intercept_call_color_set(Evas_Object *eo_obj, int r, int g, int b,
int a)
+evas_object_intercept_call_color_set(Evas_Object *eo_obj,
+ Evas_Object_Protected_Data *obj,
+ int r, int g, int b, int a)
{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
int ret;
if (!obj->interceptors) return 0;
@@ -220,9 +161,8 @@ evas_object_intercept_call_clip_set(Evas_Object *eo_obj,
Evas_Object_Protected_D
}
int
-evas_object_intercept_call_clip_unset(Evas_Object *eo_obj)
+evas_object_intercept_call_clip_unset(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj)
{
- Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
int ret;
if (!obj->interceptors) return 0;
diff --git a/src/lib/evas/canvas/evas_object_main.c
b/src/lib/evas/canvas/evas_object_main.c
index ef709c6..d7f3ae6 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -792,7 +792,7 @@ _size_set(Eo *eo_obj, void *_pd, va_list *list)
if (!obj->layer) return;
if (w < 0) w = 0; if (h < 0) h = 0;
- if (evas_object_intercept_call_resize(eo_obj, w, h)) return;
+ if (evas_object_intercept_call_resize(eo_obj, obj, w, h)) return;
if (obj->doing.in_resize > 0)
{
@@ -1373,7 +1373,7 @@ _show(Evas_Object *eo_obj, Evas_Object_Protected_Data
*obj)
{
if (!obj->layer) return;
if (obj->delete_me) return;
- if (evas_object_intercept_call_show(eo_obj)) return;
+ if (evas_object_intercept_call_show(eo_obj, obj)) return;
if (obj->is_smart)
{
eo_do(eo_obj, evas_obj_smart_show());
@@ -1422,7 +1422,7 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data
*obj)
MAGIC_CHECK_END();
if (!obj->layer) return;
if (obj->delete_me) return;
- if (evas_object_intercept_call_hide(eo_obj)) return;
+ if (evas_object_intercept_call_hide(eo_obj, obj)) return;
if (obj->is_smart)
{
eo_do(eo_obj, evas_obj_smart_hide());
@@ -1580,7 +1580,7 @@ _color_set(Eo *eo_obj, void *_pd, va_list *list)
ERR("Evas only handles pre multiplied colors!");
}
- if (evas_object_intercept_call_color_set(eo_obj, r, g, b, a)) return;
+ if (evas_object_intercept_call_color_set(eo_obj, obj, r, g, b, a)) return;
if (obj->is_smart)
{
eo_do(eo_obj, evas_obj_smart_color_set(r, g, b, a));
diff --git a/src/lib/evas/canvas/evas_stack.c b/src/lib/evas/canvas/evas_stack.c
index 313e411..6fbc78c 100644
--- a/src/lib/evas/canvas/evas_stack.c
+++ b/src/lib/evas/canvas/evas_stack.c
@@ -49,9 +49,10 @@ evas_object_raise(Evas_Object *eo_obj)
void
_raise(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
{
- if (evas_object_intercept_call_raise(eo_obj)) return;
-
Evas_Object_Protected_Data *obj = _pd;
+
+ if (evas_object_intercept_call_raise(eo_obj, obj)) return;
+
if (!((EINA_INLIST_GET(obj))->next))
{
evas_object_inform_call_restack(eo_obj);
@@ -105,9 +106,10 @@ evas_object_lower(Evas_Object *eo_obj)
void
_lower(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
{
- if (evas_object_intercept_call_lower(eo_obj)) return;
-
Evas_Object_Protected_Data *obj = _pd;
+
+ if (evas_object_intercept_call_lower(eo_obj, obj)) return;
+
if (!((EINA_INLIST_GET(obj))->prev))
{
evas_object_inform_call_restack(eo_obj);
@@ -162,16 +164,17 @@ evas_object_stack_above(Evas_Object *eo_obj, Evas_Object
*above)
void
_stack_above(Eo *eo_obj, void *_pd, va_list *list)
{
+ Evas_Object_Protected_Data *obj = _pd;
Evas_Object *eo_above = va_arg(*list, Evas_Object *);
+
if (!eo_above) return;
if (eo_obj == eo_above) return;
- if (evas_object_intercept_call_stack_above(eo_obj, eo_above)) return;
+ if (evas_object_intercept_call_stack_above(eo_obj, obj, eo_above)) return;
if (!eo_above)
{
evas_object_raise(eo_obj);
return;
}
- Evas_Object_Protected_Data *obj = _pd;
Evas_Object_Protected_Data *above = eo_data_scope_get(eo_above,
EVAS_OBJ_CLASS);
if ((EINA_INLIST_GET(obj))->prev == EINA_INLIST_GET(above))
{
@@ -250,15 +253,16 @@ void
_stack_below(Eo *eo_obj, void *_pd, va_list *list)
{
Evas_Object *eo_below = va_arg(*list, Evas_Object *);
+ Evas_Object_Protected_Data *obj = _pd;
+
if (!eo_below) return;
if (eo_obj == eo_below) return;
- if (evas_object_intercept_call_stack_below(eo_obj, eo_below)) return;
+ if (evas_object_intercept_call_stack_below(eo_obj, obj, eo_below)) return;
if (!eo_below)
{
evas_object_lower(eo_obj);
return;
}
- Evas_Object_Protected_Data *obj = _pd;
Evas_Object_Protected_Data *below = eo_data_scope_get(eo_below,
EVAS_OBJ_CLASS);
if ((EINA_INLIST_GET(obj))->next == EINA_INLIST_GET(below))
{
--
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk