summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-02-27 16:56:45 -0800
committerCedric BAIL <cedric@osg.samsung.com>2017-02-28 11:04:34 -0800
commitb4381fd2d54f419c31794b61fe7bc680119c6f17 (patch)
treec3ca7abbcf63941aead6f854988ce942be4194b5
parentda22b6fc669fc1117d27f4bed12b77a9d623eca1 (diff)
ecore_evas: rely as much as possible on display source for animator to reduce spurious tick.
-rw-r--r--src/lib/ecore_evas/ecore_evas.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 73fd146021..c560d5cb37 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -2866,27 +2866,64 @@ ecore_evas_animator_tick(Ecore_Evas *ee, Eina_Rectangle *viewport, double loop_t
2866} 2866}
2867 2867
2868static void 2868static void
2869_ecore_evas_custom_tick_begin(void *data)
2870{
2871 Ecore_Evas *ee = data;
2872
2873 if (ee->anim_count++ > 0) return;
2874
2875 ee->engine.func->fn_animator_register(ee);
2876}
2877
2878static void
2879_ecore_evas_custom_tick_end(void *data)
2880{
2881 Ecore_Evas *ee = data;
2882
2883 if ((--ee->anim_count) > 0) return;
2884
2885 ee->engine.func->fn_animator_unregister(ee);
2886}
2887
2888static void
2869_ecore_evas_tick_source_find(void) 2889_ecore_evas_tick_source_find(void)
2870{ 2890{
2871 Ecore_Evas *ee; 2891 Ecore_Evas *ee;
2892 Ecore_Evas *standby = NULL;
2872 2893
2873 _general_tick = NULL; 2894 _general_tick = NULL;
2874 EINA_INLIST_FOREACH(ecore_evases, ee) 2895 EINA_INLIST_FOREACH(ecore_evases, ee)
2875 if (ee->anim_count && 2896 if (ee->engine.func->fn_animator_register &&
2876 ee->engine.func->fn_animator_register &&
2877 ee->engine.func->fn_animator_unregister) 2897 ee->engine.func->fn_animator_unregister)
2878 { 2898 {
2879 _general_tick = ee; 2899 if (ee->anim_count)
2880 break; 2900 {
2901 _general_tick = ee;
2902 break;
2903 }
2904 else
2905 {
2906 standby = ee;
2907 }
2881 } 2908 }
2882 2909
2910 // If no general source is already ticking pick one.
2911 if (!_general_tick && standby)
2912 {
2913 _general_tick = standby;
2914 }
2915
2883 if (!_general_tick) 2916 if (!_general_tick)
2884 { 2917 {
2885 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); 2918 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
2886 } 2919 }
2887 else 2920 else
2888 { 2921 {
2922 // Source set will trigger the previous tick end registered and then the new begin.
2923 // As we don't what was in behind, better first begin and end after source is set.
2924 ecore_animator_custom_source_tick_begin_callback_set(_ecore_evas_custom_tick_begin, _general_tick);
2889 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); 2925 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
2926 ecore_animator_custom_source_tick_end_callback_set(_ecore_evas_custom_tick_end, _general_tick);
2890 } 2927 }
2891} 2928}
2892 2929