efl_canvas_animation: be more explicit with errors

Summary:
with this commit invalid values are not accepted silently anymore. But
rather a error will be raised.
Depends on D10350

Reviewers: segfaultxavi, Jaehyun_Cho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8288

Differential Revision: https://phab.enlightenment.org/D10558
This commit is contained in:
Marcel Hollerbach 2019-10-30 15:30:09 +01:00 committed by Xavi Artigas
parent f47b927745
commit 92a4fab5d7
2 changed files with 6 additions and 7 deletions

View File

@ -38,9 +38,8 @@ _efl_canvas_animation_repeat_mode_set(Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Data *pd,
Efl_Canvas_Animation_Repeat_Mode mode)
{
if ((mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_RESTART) ||
(mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE))
pd->repeat_mode = mode;
EINA_SAFETY_ON_FALSE_RETURN(mode >= 0 && mode < EFL_CANVAS_ANIMATION_REPEAT_MODE_LAST);
pd->repeat_mode = mode;
}
EOLIAN static Efl_Canvas_Animation_Repeat_Mode
@ -54,8 +53,7 @@ _efl_canvas_animation_repeat_count_set(Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Data *pd,
int count)
{
//EFL_ANIMATION_REPEAT_INFINITE repeats animation infinitely
if ((count < 0) && (count != EFL_ANIMATION_REPEAT_INFINITE)) return;
EINA_SAFETY_ON_FALSE_RETURN(count >= EFL_ANIMATION_REPEAT_INFINITE);
pd->repeat_count = count;
}
@ -71,7 +69,7 @@ _efl_canvas_animation_start_delay_set(Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Data *pd,
double sec)
{
if (sec < 0.0) return;
EINA_SAFETY_ON_FALSE_RETURN(sec < 0.0);
pd->start_delay_time = sec;
}

View File

@ -8,5 +8,6 @@ enum @beta Efl.Canvas.Animation_Repeat_Mode
[[Animation repeat mode]]
restart = 0, [[Restart animation when the animation ends.]]
reverse [[Reverse animation when the animation ends.]]
reverse = 1, [[Reverse animation when the animation ends.]]
last
}