summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_canvas_animation_player.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-24 11:18:57 -0400
committerCedric Bail <cedric.bail@free.fr>2019-09-24 15:23:15 -0700
commit3d3cdc5955560726f0b9a8cef492274a1f7254a4 (patch)
treedb17c01b91b5a1d98367a2e168154fd1a0f4c974 /src/lib/evas/canvas/efl_canvas_animation_player.c
parent89bee7a11a61d08cc758b061fd2f5e705d1f9029 (diff)
efl/player: rename 'play' property to 'pause'
this is a bit of an overhaul wherein the existing 'play' mechanics are all inverted. 'pause' is a state which stops playback but does not affect the playback_position property. this patch also includes implementations of Efl.Player::playing for a couple classes which (now) only implement pause, as this is a requirement for the objects to actually activate their animations test cases: * unit tests * all elm_test animation cases * elm_test video * rage Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10114
Diffstat (limited to '')
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_player.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c
index 981ece8b80..45c3be5859 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_player.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_player.c
@@ -222,35 +222,25 @@ _player_stop(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Efl_Canvas_Animat
222 //Reset the state of the target to the initial state 222 //Reset the state of the target to the initial state
223 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj)); 223 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
224 224
225 Eina_Bool play = efl_player_play_get(eo_obj); 225 if (efl_animation_final_state_keep_get(anim))
226 if (play)
227 { 226 {
228 efl_player_play_set(eo_obj, EINA_FALSE); 227 if (_is_final_state(anim, pd->progress))
229 if (efl_animation_final_state_keep_get(anim))
230 { 228 {
231 if (_is_final_state(anim, pd->progress)) 229 /* Keep the final state only if efl_player_playing_set(EINA_FALSE) is called at
232 { 230 * the end of _animator_cb. */
233 /* Keep the final state only if efl_player_stop is called at 231 efl_animation_apply(anim, pd->progress,
234 * the end of _animator_cb. */ 232 efl_animation_player_target_get(eo_obj));
235 efl_animation_apply(anim, pd->progress,
236 efl_animation_player_target_get(eo_obj));
237 }
238 else
239 {
240 pd->progress = 0.0;
241 }
242 } 233 }
243 else 234 else
244 { 235 {
245 pd->progress = 0.0; 236 pd->progress = 0.0;
246 } 237 }
247 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
248 } 238 }
249 else 239 else
250 { 240 {
251 pd->progress = 0.0; 241 pd->progress = 0.0;
252 } 242 }
253 243 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
254 if (pd->auto_del) efl_del(eo_obj); 244 if (pd->auto_del) efl_del(eo_obj);
255} 245}
256 246
@@ -266,6 +256,8 @@ _efl_canvas_animation_player_efl_player_playing_set(Eo *eo_obj, Efl_Canvas_Anima
266 pd->is_play = !!playing; 256 pd->is_play = !!playing;
267 if (!playing) 257 if (!playing)
268 { 258 {
259 if (!pd->is_play) return EINA_TRUE;
260 pd->is_paused = EINA_FALSE;
269 _player_stop(eo_obj, pd, anim); 261 _player_stop(eo_obj, pd, anim);
270 return EINA_TRUE; 262 return EINA_TRUE;
271 } 263 }
@@ -290,19 +282,20 @@ _efl_canvas_animation_player_efl_player_playing_get(const Eo *eo_obj EINA_UNUSED
290 return pd->is_play; 282 return pd->is_play;
291} 283}
292 284
293EOLIAN static void 285EOLIAN static Eina_Bool
294_efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj, 286_efl_canvas_animation_player_efl_player_paused_set(Eo *eo_obj,
295 Efl_Canvas_Animation_Player_Data *pd, 287 Efl_Canvas_Animation_Player_Data *pd,
296 Eina_Bool play) 288 Eina_Bool paused)
297{ 289{
298 if (efl_player_play_get(eo_obj) == !!play) 290 paused = !!paused;
299 return; 291 /* can't pause if not playing */
300 292 if (!pd->is_play) return EINA_FALSE;
301 pd->is_play = play; 293 if (pd->is_paused == paused) return EINA_TRUE;
302 if (play) 294 pd->is_paused = paused;
295 if (!paused)
303 { 296 {
304 //TODO: check this case is correct. 297 //TODO: check this case is correct.
305 if (pd->start_delay_timer) return; 298 if (pd->start_delay_timer) return EINA_FALSE;
306 299
307 pd->time.prev = ecore_loop_time_get(); 300 pd->time.prev = ecore_loop_time_get();
308 pd->animator = ecore_evas_animator_add(pd->target, _animator_cb, eo_obj); 301 pd->animator = ecore_evas_animator_add(pd->target, _animator_cb, eo_obj);
@@ -316,13 +309,14 @@ _efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj,
316 ecore_animator_del(pd->animator); 309 ecore_animator_del(pd->animator);
317 pd->animator = NULL; 310 pd->animator = NULL;
318 } 311 }
312 return EINA_TRUE;
319} 313}
320 314
321EOLIAN static Eina_Bool 315EOLIAN static Eina_Bool
322_efl_canvas_animation_player_efl_player_play_get(const Eo *eo_obj EINA_UNUSED, 316_efl_canvas_animation_player_efl_player_paused_get(const Eo *eo_obj EINA_UNUSED,
323 Efl_Canvas_Animation_Player_Data *pd) 317 Efl_Canvas_Animation_Player_Data *pd)
324{ 318{
325 return pd->is_play; 319 return pd->is_paused;
326} 320}
327 321
328EOLIAN static Eina_Bool 322EOLIAN static Eina_Bool