summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-05-03 16:08:36 -0700
committerCedric Bail <cedric@osg.samsung.com>2017-05-05 17:55:06 -0700
commit385acef7f9d0bd733bd47165496168b52bd99f3f (patch)
treed0b25014a9adf6896cf82acab39789f4a9efef4d /src/lib/ecore_evas
parentd7a27363bd1889e3cc3f96d21867fe393fbc1429 (diff)
ecore_evas: introduce a generic rendering function.
Diffstat (limited to 'src/lib/ecore_evas')
-rw-r--r--src/lib/ecore_evas/ecore_evas.c86
-rw-r--r--src/lib/ecore_evas/ecore_evas_private.h6
2 files changed, 90 insertions, 2 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index d34fa8e6e3..50ad308dfa 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -142,6 +142,75 @@ _ecore_evas_idle_exiter(void *data EINA_UNUSED)
142 return ECORE_CALLBACK_RENEW; 142 return ECORE_CALLBACK_RENEW;
143} 143}
144 144
145EAPI void
146ecore_evas_render_wait(Ecore_Evas *ee)
147{
148 if (ee->in_async_render) evas_sync(ee->evas);
149}
150
151EAPI Eina_Bool
152ecore_evas_render(Ecore_Evas *ee)
153{
154 Eina_List *ll;
155 Ecore_Evas *ee2;
156 Eina_Bool rend = EINA_FALSE;
157
158 if (ee->in_async_render)
159 {
160 DBG("ee=%p is rendering, skip.", ee);
161 return EINA_TRUE;
162 }
163
164 if (ee->engine.func->fn_prepare)
165 if (!ee->engine.func->fn_prepare(ee))
166 return EINA_FALSE;
167
168 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
169 {
170 if (ee2->engine.func->fn_render)
171 rend |= ee2->engine.func->fn_render(ee2);
172 else
173 rend |= ecore_evas_render(ee2);
174 }
175 // We do not force the child to be sync, so we should wait for them to be done
176 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
177 ecore_evas_render_wait(ee2);
178
179 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
180
181 ee->in_async_render = 1;
182
183 if (!ee->visible)
184 {
185 evas_norender(ee->evas);
186 }
187 else if (ee->can_async_render && !ee->manual_render)
188 {
189 rend |= !!evas_render_async(ee->evas);
190 }
191 else
192 {
193 Eina_List *updates;
194
195 updates = evas_render_updates(ee->evas);
196 rend |= !!updates;
197 evas_render_updates_free(updates);
198 }
199
200 return rend;
201}
202
203static void
204_evas_evas_buffer_rendered(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
205{
206 Ecore_Evas *ee = data;
207
208 _ecore_evas_idle_timeout_update(ee);
209
210 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
211 ee->in_async_render = 0;
212}
213
145static Eina_Bool 214static Eina_Bool
146_ecore_evas_idle_enter(void *data EINA_UNUSED) 215_ecore_evas_idle_enter(void *data EINA_UNUSED)
147{ 216{
@@ -221,8 +290,12 @@ _ecore_evas_idle_enter(void *data EINA_UNUSED)
221 if (ee->engine.func->fn_render) 290 if (ee->engine.func->fn_render)
222 { 291 {
223 change = ee->engine.func->fn_render(ee); 292 change = ee->engine.func->fn_render(ee);
224 rend |= change;
225 } 293 }
294 else
295 {
296 change = ecore_evas_render(ee);
297 }
298 rend |= change;
226 /* 299 /*
227 * Some engines that generate their own ticks based on hardware 300 * Some engines that generate their own ticks based on hardware
228 * events need to know that render has been considered, and 301 * events need to know that render has been considered, and
@@ -2470,7 +2543,14 @@ ecore_evas_manual_render(Ecore_Evas *ee)
2470{ 2543{
2471 ECORE_EVAS_CHECK(ee); 2544 ECORE_EVAS_CHECK(ee);
2472 if (ee->engine.func->fn_render) 2545 if (ee->engine.func->fn_render)
2473 ee->engine.func->fn_render(ee); 2546 {
2547 ee->engine.func->fn_render(ee);
2548 }
2549 else
2550 {
2551 ecore_evas_render(ee);
2552 ecore_evas_render_wait(ee);
2553 }
2474} 2554}
2475 2555
2476EAPI void 2556EAPI void
@@ -3027,6 +3107,8 @@ _ecore_evas_register(Ecore_Evas *ee)
3027 3107
3028 if (_ecore_evas_render_sync) ee->first_frame = EINA_TRUE; 3108 if (_ecore_evas_render_sync) ee->first_frame = EINA_TRUE;
3029 if (!_general_tick) _ecore_evas_tick_source_find(); 3109 if (!_general_tick) _ecore_evas_tick_source_find();
3110 if (!ee->engine.func->fn_render)
3111 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _evas_evas_buffer_rendered, ee);
3030} 3112}
3031 3113
3032EAPI void 3114EAPI void
diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h
index 25fa6def0d..6f1d8293ef 100644
--- a/src/lib/ecore_evas/ecore_evas_private.h
+++ b/src/lib/ecore_evas/ecore_evas_private.h
@@ -167,6 +167,8 @@ struct _Ecore_Evas_Engine_Func
167 void (*fn_callback_device_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func); 167 void (*fn_callback_device_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func);
168 void (*fn_callback_device_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func); 168 void (*fn_callback_device_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func);
169 void (*fn_pointer_device_xy_get)(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y); 169 void (*fn_pointer_device_xy_get)(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y);
170
171 Eina_Bool (*fn_prepare)(Ecore_Evas *ee);
170}; 172};
171 173
172struct _Ecore_Evas_Interface 174struct _Ecore_Evas_Interface
@@ -474,6 +476,10 @@ EAPI void _ecore_evas_default_cursor_hide(Ecore_Evas *ee);
474 476
475Eina_Bool _ecore_evas_cursors_init(Ecore_Evas *ee); 477Eina_Bool _ecore_evas_cursors_init(Ecore_Evas *ee);
476 478
479EAPI void ecore_evas_render_wait(Ecore_Evas *ee);
480EAPI Eina_Bool ecore_evas_render(Ecore_Evas *ee);
481
482
477#undef EAPI 483#undef EAPI
478#define EAPI 484#define EAPI
479 485