From d0218f1b06976d0ebfa8ef41432caae81b0371b3 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 18 Sep 2018 09:42:29 -0500 Subject: [PATCH] ecore_evas: Refactor out ticking start/stop as functions Summary: These are the refcounted ticky guts of the signal add/del catchers, we'll need to use these to start/stop from other call chains in the near future. Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7039 --- src/lib/ecore_evas/ecore_evas.c | 74 ++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 2909d7c..3b3eba4 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -3372,6 +3372,47 @@ _ecore_evas_animator_fallback(void *data) } static void +_ticking_start(Ecore_Evas *ee) +{ + if (!ee->animator_count) + INF("Setting up animator for %p from '%s' with title '%s'.", ee->evas, ee->driver, ee->prop.title); + + if (ee->engine.func->fn_animator_register && + ee->engine.func->fn_animator_unregister) + { + // Backend support per window vsync + ecore_evas_tick_begin(ee); + } + else + { + // Backend doesn't support per window vsync, fallback to generic support + if (ee->animator_count++ > 0) return; + ee->anim = ecore_animator_add(_ecore_evas_animator_fallback, ee); + } +} + +static void +_ticking_stop(Ecore_Evas *ee) +{ + if (ee->animator_count == 1) + INF("Unsetting up animator for %p from '%s' titled '%s'.", ee->evas, ee->driver, ee->prop.title); + + if (ee->engine.func->fn_animator_register && + ee->engine.func->fn_animator_unregister) + { + // Backend support per window vsync + ecore_evas_tick_end(ee); + } + else + { + // Backend doesn't support per window vsync, fallback to generic support + if (--ee->animator_count > 0) return; + ecore_animator_del(ee->anim); + ee->anim = NULL; + } +} + +static void _check_animator_event_catcher_add(void *data, const Efl_Event *event) { const Efl_Callback_Array_Item_Full *array = event->info; @@ -3382,21 +3423,7 @@ _check_animator_event_catcher_add(void *data, const Efl_Event *event) { if (array[i].desc == EFL_EVENT_ANIMATOR_TICK) { - if (!ee->animator_count) - INF("Setting up animator for %p from '%s' with title '%s'.", ee->evas, ee->driver, ee->prop.title); - - if (ee->engine.func->fn_animator_register && - ee->engine.func->fn_animator_unregister) - { - // Backend support per window vsync - ecore_evas_tick_begin(ee); - } - else - { - // Backend doesn't support per window vsync, fallback to generic support - if (ee->animator_count++ > 0) return; - ee->anim = ecore_animator_add(_ecore_evas_animator_fallback, ee); - } + _ticking_start(ee); // No need to walk more than once per array as you can not del // a partial array @@ -3416,22 +3443,7 @@ _check_animator_event_catcher_del(void *data, const Efl_Event *event) { if (array[i].desc == EFL_EVENT_ANIMATOR_TICK) { - if (ee->animator_count == 1) - INF("Unsetting up animator for %p from '%s' titled '%s'.", ee->evas, ee->driver, ee->prop.title); - - if (ee->engine.func->fn_animator_register && - ee->engine.func->fn_animator_unregister) - { - // Backend support per window vsync - ecore_evas_tick_end(ee); - } - else - { - // Backend doesn't support per window vsync, fallback to generic support - if (--ee->animator_count > 0) return; - ecore_animator_del(ee->anim); - ee->anim = NULL; - } + _ticking_stop(ee); return; } } -- 2.7.4