summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-08-29 10:53:48 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-08-29 10:53:48 +0900
commit85f0749a83a2d1eeb474d92de077d484aa195b64 (patch)
tree062ffc1ec1e5acf3f0438ead6e867382f4333f9a
parent62a759de4346c344983dd055dde47f8c7919c7a4 (diff)
evas: cleanup intercept code and improve performance there a little.
-rw-r--r--src/lib/evas/canvas/evas_clip.c2
-rw-r--r--src/lib/evas/canvas/evas_layer.c2
-rw-r--r--src/lib/evas/canvas/evas_object_intercept.c204
-rw-r--r--src/lib/evas/canvas/evas_object_main.c8
-rw-r--r--src/lib/evas/canvas/evas_stack.c20
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 0d3999e3fb..70134ebb65 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)
374 obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer); 374 obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer);
375 375
376 /* unclip */ 376 /* unclip */
377 if (evas_object_intercept_call_clip_unset(eo_obj)) return; 377 if (evas_object_intercept_call_clip_unset(eo_obj, obj)) return;
378 if (obj->is_smart) 378 if (obj->is_smart)
379 { 379 {
380 eo_do(eo_obj, evas_obj_smart_clip_unset()); 380 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 2484d6c029..3c2a622eb1 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)
193 Evas_Object_Protected_Data *obj = _obj; 193 Evas_Object_Protected_Data *obj = _obj;
194 194
195 if (obj->delete_me) return; 195 if (obj->delete_me) return;
196 if (evas_object_intercept_call_layer_set(eo_obj, l)) return; 196 if (evas_object_intercept_call_layer_set(eo_obj, obj, l)) return;
197 if (obj->smart.parent) return; 197 if (obj->smart.parent) return;
198 if (obj->cur->layer == l) 198 if (obj->cur->layer == l)
199 { 199 {
diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c
index 7bf695441a..ff3d5c1e92 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)
45 if (obj->interceptors) free(obj->interceptors); 45 if (obj->interceptors) free(obj->interceptors);
46} 46}
47 47
48int 48#define EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(Type) \
49evas_object_intercept_call_show(Evas_Object *eo_obj) 49 int \
50{ 50 evas_object_intercept_call_##Type(Evas_Object *eo_obj, \
51 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); 51 Evas_Object_Protected_Data *obj) \
52 int ret; 52 { \
53 53 int ret; \
54 if (!obj->interceptors) return 0; 54 \
55 if (obj->intercepted) return 0; 55 if (!obj->interceptors) return 0; \
56 obj->intercepted = EINA_TRUE; 56 if (obj->intercepted) return 0; \
57 ret = !!(obj->interceptors->show.func); 57 obj->intercepted = EINA_TRUE; \
58 if (ret) 58 ret = !!(obj->interceptors->Type.func); \
59 obj->interceptors->show.func(obj->interceptors->show.data, eo_obj); 59 if (ret) \
60 obj->intercepted = EINA_FALSE; 60 obj->interceptors->Type.func(obj->interceptors->Type.data, eo_obj); \
61 return ret; 61 obj->intercepted = EINA_FALSE; \
62} 62 return ret; \
63 }
64
65EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(show);
66EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(hide);
67EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(raise);
68EVAS_OBJECT_INTERCEPT_CALL_SIMPLE(lower);
69
70#define EVAS_OBJECT_INTERCEPT_CALL_GEOMETRY(Type) \
71 int \
72 evas_object_intercept_call_##Type(Evas_Object *eo_obj, \
73 Evas_Object_Protected_Data *obj, \
74 Evas_Coord a, Evas_Coord b) \
75 { \
76 int ret; \
77 \
78 if (!obj->interceptors) return 0; \
79 if (obj->intercepted) return 0; \
80 obj->intercepted = EINA_TRUE; \
81 ret = !!(obj->interceptors->Type.func); \
82 if (ret) \
83 obj->interceptors->Type.func(obj->interceptors->Type.data, \
84 eo_obj, a , b); \
85 obj->intercepted = EINA_FALSE; \
86 return ret; \
87 }
88
89EVAS_OBJECT_INTERCEPT_CALL_GEOMETRY(move);
90EVAS_OBJECT_INTERCEPT_CALL_GEOMETRY(resize);
91
92#define EVAS_OBJECT_INTERCEPT_CALL_STACKING(Type) \
93 int \
94 evas_object_intercept_call_##Type(Evas_Object *eo_obj, \
95 Evas_Object_Protected_Data *obj, \
96 Evas_Object *rel_to) \
97 { \
98 int ret; \
99 \
100 if (!obj->interceptors) return 0; \
101 if (obj->intercepted) return 0; \
102 obj->intercepted = EINA_TRUE; \
103 ret = !!(obj->interceptors->Type.func); \
104 if (ret) \
105 obj->interceptors->Type.func(obj->interceptors->Type.data, \
106 eo_obj, rel_to); \
107 obj->intercepted = EINA_FALSE; \
108 return ret; \
109 }
110
111EVAS_OBJECT_INTERCEPT_CALL_STACKING(stack_above);
112EVAS_OBJECT_INTERCEPT_CALL_STACKING(stack_below);
63 113
64int 114int
65evas_object_intercept_call_hide(Evas_Object *eo_obj) 115evas_object_intercept_call_layer_set(Evas_Object *eo_obj,
116 Evas_Object_Protected_Data *obj,
117 int l)
66{ 118{
67 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
68 int ret;
69
70 if (!obj->interceptors) return 0;
71 if (obj->intercepted) return 0;
72 obj->intercepted = EINA_TRUE;
73 ret = !!(obj->interceptors->hide.func);
74 if (ret)
75 obj->interceptors->hide.func(obj->interceptors->hide.data, eo_obj);
76 obj->intercepted = EINA_FALSE;
77 return ret;
78}
79
80int
81evas_object_intercept_call_move(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord x, Evas_Coord y)
82{
83 int ret;
84
85 if (!obj->interceptors) return 0;
86 if (obj->intercepted) return 0;
87 obj->intercepted = EINA_TRUE;
88 ret = !!(obj->interceptors->move.func);
89 if (ret)
90 obj->interceptors->move.func(obj->interceptors->move.data, eo_obj, x, y);
91 obj->intercepted = EINA_FALSE;
92 return ret;
93}
94
95int
96evas_object_intercept_call_resize(Evas_Object *eo_obj, Evas_Coord w, Evas_Coord h)
97{
98 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
99 int ret;
100
101 if (!obj->interceptors) return 0;
102 if (obj->intercepted) return 0;
103 obj->intercepted = EINA_TRUE;
104 ret = !!(obj->interceptors->resize.func);
105 if (ret)
106 obj->interceptors->resize.func(obj->interceptors->resize.data, eo_obj, w, h);
107 obj->intercepted = EINA_FALSE;
108 return ret;
109}
110
111int
112evas_object_intercept_call_raise(Evas_Object *eo_obj)
113{
114 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
115 int ret;
116
117 if (!obj->interceptors) return 0;
118 if (obj->intercepted) return 0;
119 obj->intercepted = EINA_TRUE;
120 ret = !!(obj->interceptors->raise.func);
121 if (ret)
122 obj->interceptors->raise.func(obj->interceptors->raise.data, eo_obj);
123 obj->intercepted = EINA_FALSE;
124 return ret;
125}
126
127int
128evas_object_intercept_call_lower(Evas_Object *eo_obj)
129{
130 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
131 int ret;
132
133 if (!obj->interceptors) return 0;
134 if (obj->intercepted) return 0;
135 obj->intercepted = EINA_TRUE;
136 ret = !!(obj->interceptors->lower.func);
137 if (ret)
138 obj->interceptors->lower.func(obj->interceptors->lower.data, eo_obj);
139 obj->intercepted = EINA_FALSE;
140 return ret;
141}
142
143int
144evas_object_intercept_call_stack_above(Evas_Object *eo_obj, Evas_Object *above)
145{
146 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
147 int ret;
148
149 if (!obj->interceptors) return 0;
150 if (obj->intercepted) return 0;
151 obj->intercepted = EINA_TRUE;
152 ret = !!(obj->interceptors->stack_above.func);
153 if (ret)
154 obj->interceptors->stack_above.func(obj->interceptors->stack_above.data, eo_obj, above);
155 obj->intercepted = EINA_FALSE;
156 return ret;
157}
158
159int
160evas_object_intercept_call_stack_below(Evas_Object *eo_obj, Evas_Object *below)
161{
162 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
163 int ret;
164
165 if (!obj->interceptors) return 0;
166 if (obj->intercepted) return 0;
167 obj->intercepted = EINA_TRUE;
168 ret = !!(obj->interceptors->stack_below.func);
169 if (ret)
170 obj->interceptors->stack_below.func(obj->interceptors->stack_below.data, eo_obj, below);
171 obj->intercepted = EINA_FALSE;
172 return ret;
173}
174
175int
176evas_object_intercept_call_layer_set(Evas_Object *eo_obj, int l)
177{
178 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
179 int ret; 119 int ret;
180 120
181 if (!obj->interceptors) return 0; 121 if (!obj->interceptors) return 0;
@@ -189,9 +129,10 @@ evas_object_intercept_call_layer_set(Evas_Object *eo_obj, int l)
189} 129}
190 130
191int 131int
192evas_object_intercept_call_color_set(Evas_Object *eo_obj, int r, int g, int b, int a) 132evas_object_intercept_call_color_set(Evas_Object *eo_obj,
133 Evas_Object_Protected_Data *obj,
134 int r, int g, int b, int a)
193{ 135{
194 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
195 int ret; 136 int ret;
196 137
197 if (!obj->interceptors) return 0; 138 if (!obj->interceptors) return 0;
@@ -220,9 +161,8 @@ evas_object_intercept_call_clip_set(Evas_Object *eo_obj, Evas_Object_Protected_D
220} 161}
221 162
222int 163int
223evas_object_intercept_call_clip_unset(Evas_Object *eo_obj) 164evas_object_intercept_call_clip_unset(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
224{ 165{
225 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
226 int ret; 166 int ret;
227 167
228 if (!obj->interceptors) return 0; 168 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 ef709c62d0..d7f3ae672f 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)
792 if (!obj->layer) return; 792 if (!obj->layer) return;
793 if (w < 0) w = 0; if (h < 0) h = 0; 793 if (w < 0) w = 0; if (h < 0) h = 0;
794 794
795 if (evas_object_intercept_call_resize(eo_obj, w, h)) return; 795 if (evas_object_intercept_call_resize(eo_obj, obj, w, h)) return;
796 796
797 if (obj->doing.in_resize > 0) 797 if (obj->doing.in_resize > 0)
798 { 798 {
@@ -1373,7 +1373,7 @@ _show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1373{ 1373{
1374 if (!obj->layer) return; 1374 if (!obj->layer) return;
1375 if (obj->delete_me) return; 1375 if (obj->delete_me) return;
1376 if (evas_object_intercept_call_show(eo_obj)) return; 1376 if (evas_object_intercept_call_show(eo_obj, obj)) return;
1377 if (obj->is_smart) 1377 if (obj->is_smart)
1378 { 1378 {
1379 eo_do(eo_obj, evas_obj_smart_show()); 1379 eo_do(eo_obj, evas_obj_smart_show());
@@ -1422,7 +1422,7 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1422 MAGIC_CHECK_END(); 1422 MAGIC_CHECK_END();
1423 if (!obj->layer) return; 1423 if (!obj->layer) return;
1424 if (obj->delete_me) return; 1424 if (obj->delete_me) return;
1425 if (evas_object_intercept_call_hide(eo_obj)) return; 1425 if (evas_object_intercept_call_hide(eo_obj, obj)) return;
1426 if (obj->is_smart) 1426 if (obj->is_smart)
1427 { 1427 {
1428 eo_do(eo_obj, evas_obj_smart_hide()); 1428 eo_do(eo_obj, evas_obj_smart_hide());
@@ -1580,7 +1580,7 @@ _color_set(Eo *eo_obj, void *_pd, va_list *list)
1580 ERR("Evas only handles pre multiplied colors!"); 1580 ERR("Evas only handles pre multiplied colors!");
1581 } 1581 }
1582 1582
1583 if (evas_object_intercept_call_color_set(eo_obj, r, g, b, a)) return; 1583 if (evas_object_intercept_call_color_set(eo_obj, obj, r, g, b, a)) return;
1584 if (obj->is_smart) 1584 if (obj->is_smart)
1585 { 1585 {
1586 eo_do(eo_obj, evas_obj_smart_color_set(r, g, b, a)); 1586 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 313e411e73..6fbc78c53a 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)
49void 49void
50_raise(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 50_raise(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
51{ 51{
52 if (evas_object_intercept_call_raise(eo_obj)) return;
53
54 Evas_Object_Protected_Data *obj = _pd; 52 Evas_Object_Protected_Data *obj = _pd;
53
54 if (evas_object_intercept_call_raise(eo_obj, obj)) return;
55
55 if (!((EINA_INLIST_GET(obj))->next)) 56 if (!((EINA_INLIST_GET(obj))->next))
56 { 57 {
57 evas_object_inform_call_restack(eo_obj); 58 evas_object_inform_call_restack(eo_obj);
@@ -105,9 +106,10 @@ evas_object_lower(Evas_Object *eo_obj)
105void 106void
106_lower(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 107_lower(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
107{ 108{
108 if (evas_object_intercept_call_lower(eo_obj)) return;
109
110 Evas_Object_Protected_Data *obj = _pd; 109 Evas_Object_Protected_Data *obj = _pd;
110
111 if (evas_object_intercept_call_lower(eo_obj, obj)) return;
112
111 if (!((EINA_INLIST_GET(obj))->prev)) 113 if (!((EINA_INLIST_GET(obj))->prev))
112 { 114 {
113 evas_object_inform_call_restack(eo_obj); 115 evas_object_inform_call_restack(eo_obj);
@@ -162,16 +164,17 @@ evas_object_stack_above(Evas_Object *eo_obj, Evas_Object *above)
162void 164void
163_stack_above(Eo *eo_obj, void *_pd, va_list *list) 165_stack_above(Eo *eo_obj, void *_pd, va_list *list)
164{ 166{
167 Evas_Object_Protected_Data *obj = _pd;
165 Evas_Object *eo_above = va_arg(*list, Evas_Object *); 168 Evas_Object *eo_above = va_arg(*list, Evas_Object *);
169
166 if (!eo_above) return; 170 if (!eo_above) return;
167 if (eo_obj == eo_above) return; 171 if (eo_obj == eo_above) return;
168 if (evas_object_intercept_call_stack_above(eo_obj, eo_above)) return; 172 if (evas_object_intercept_call_stack_above(eo_obj, obj, eo_above)) return;
169 if (!eo_above) 173 if (!eo_above)
170 { 174 {
171 evas_object_raise(eo_obj); 175 evas_object_raise(eo_obj);
172 return; 176 return;
173 } 177 }
174 Evas_Object_Protected_Data *obj = _pd;
175 Evas_Object_Protected_Data *above = eo_data_scope_get(eo_above, EVAS_OBJ_CLASS); 178 Evas_Object_Protected_Data *above = eo_data_scope_get(eo_above, EVAS_OBJ_CLASS);
176 if ((EINA_INLIST_GET(obj))->prev == EINA_INLIST_GET(above)) 179 if ((EINA_INLIST_GET(obj))->prev == EINA_INLIST_GET(above))
177 { 180 {
@@ -250,15 +253,16 @@ void
250_stack_below(Eo *eo_obj, void *_pd, va_list *list) 253_stack_below(Eo *eo_obj, void *_pd, va_list *list)
251{ 254{
252 Evas_Object *eo_below = va_arg(*list, Evas_Object *); 255 Evas_Object *eo_below = va_arg(*list, Evas_Object *);
256 Evas_Object_Protected_Data *obj = _pd;
257
253 if (!eo_below) return; 258 if (!eo_below) return;
254 if (eo_obj == eo_below) return; 259 if (eo_obj == eo_below) return;
255 if (evas_object_intercept_call_stack_below(eo_obj, eo_below)) return; 260 if (evas_object_intercept_call_stack_below(eo_obj, obj, eo_below)) return;
256 if (!eo_below) 261 if (!eo_below)
257 { 262 {
258 evas_object_lower(eo_obj); 263 evas_object_lower(eo_obj);
259 return; 264 return;
260 } 265 }
261 Evas_Object_Protected_Data *obj = _pd;
262 Evas_Object_Protected_Data *below = eo_data_scope_get(eo_below, EVAS_OBJ_CLASS); 266 Evas_Object_Protected_Data *below = eo_data_scope_get(eo_below, EVAS_OBJ_CLASS);
263 if ((EINA_INLIST_GET(obj))->next == EINA_INLIST_GET(below)) 267 if ((EINA_INLIST_GET(obj))->next == EINA_INLIST_GET(below))
264 { 268 {