summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_canvas_animation_player.c
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2019-06-04 18:52:14 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2019-06-04 21:56:58 +0900
commit9eb0b28cc735326ab0079f49af0ae2668f9d5942 (patch)
tree1b17cd5e59d4cec616a41240c9d954bf6eab002d /src/lib/evas/canvas/efl_canvas_animation_player.c
parent28adabd21481ea244a800b1a31c69271ad619d2d (diff)
efl_canvas_animation: fix numerical error on map effect calculation
Previously, for a single canvas animation, map effect was applied in animator callback without resetting previously applied map effect. This increased numerical error because each time map effect factors (e.g. scale, degree) should be calculated based on the current map coordinates. To resolve this numerical error, now the previously applied map effect is reset before applying the current map effect in animator callback.
Diffstat (limited to 'src/lib/evas/canvas/efl_canvas_animation_player.c')
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_player.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c
index 42fb2c4127..edb4d66c53 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_player.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_player.c
@@ -107,6 +107,10 @@ _animator_cb(void *data)
107 pd->progress = (double)(pd->is_direction_forward); 107 pd->progress = (double)(pd->is_direction_forward);
108 } 108 }
109 109
110 /* The previously applied map effect should be reset before applying the
111 * current map effect. Otherwise, the incrementally added map effects
112 * increase numerical error. */
113 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
110 efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj)); 114 efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj));
111 115
112 Efl_Canvas_Animation_Player_Event_Running event_running; 116 Efl_Canvas_Animation_Player_Event_Running event_running;
@@ -207,11 +211,14 @@ _efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
207 Efl_Canvas_Animation_Player_Data *pd) 211 Efl_Canvas_Animation_Player_Data *pd)
208{ 212{
209 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); 213 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
214
215 //Reset the state of the target to the initial state
216 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
217
210 Eina_Bool play = efl_player_play_get(eo_obj); 218 Eina_Bool play = efl_player_play_get(eo_obj);
211 if (play) 219 if (play)
212 { 220 {
213 efl_player_play_set(eo_obj, EINA_FALSE); 221 efl_player_play_set(eo_obj, EINA_FALSE);
214 //Reset the state of the target to the initial state
215 if ((efl_animation_final_state_keep_get(anim)) && 222 if ((efl_animation_final_state_keep_get(anim)) &&
216 (efl_animation_repeat_mode_get(anim) != EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) && 223 (efl_animation_repeat_mode_get(anim) != EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) &&
217 (!(efl_animation_repeat_count_get(anim) & 1))) 224 (!(efl_animation_repeat_count_get(anim) & 1)))
@@ -223,14 +230,12 @@ _efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
223 else 230 else
224 { 231 {
225 pd->progress = 0.0; 232 pd->progress = 0.0;
226 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
227 } 233 }
228 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL); 234 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
229 } 235 }
230 else 236 else
231 { 237 {
232 pd->progress = 0.0; 238 pd->progress = 0.0;
233 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
234 } 239 }
235 240
236 if (pd->auto_del) efl_del(eo_obj); 241 if (pd->auto_del) efl_del(eo_obj);
@@ -303,6 +308,11 @@ _efl_canvas_animation_player_efl_player_pos_set(Eo *eo_obj,
303 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); 308 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
304 double length = efl_animation_duration_get(anim); 309 double length = efl_animation_duration_get(anim);
305 pd->progress = sec / length; 310 pd->progress = sec / length;
311
312 /* The previously applied map effect should be reset before applying the
313 * current map effect. Otherwise, the incrementally added map effects
314 * increase numerical error. */
315 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
306 efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj)); 316 efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj));
307} 317}
308 318