efl_canvas_animation_group: move from list to iterator

we should not use lists directly, ownership issues etc. etc..
This moves it to iterators

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D10787
This commit is contained in:
Marcel Hollerbach 2019-12-03 16:00:29 +01:00
parent 8cb0b193ea
commit 8daaab65fa
4 changed files with 17 additions and 17 deletions

View File

@ -41,11 +41,11 @@ _efl_canvas_animation_group_animation_del(Eo *eo_obj EINA_UNUSED,
}
}
EOLIAN static Eina_List *
EOLIAN static Eina_Iterator*
_efl_canvas_animation_group_animations_get(const Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Group_Data *pd)
{
return pd->animations;
return eina_list_iterator_new(pd->animations);
}
EOLIAN static void

View File

@ -23,7 +23,7 @@ abstract @beta Efl.Canvas.Animation_Group extends Efl.Canvas.Animation
}
animations_get @const {
[[Gets the list of animations currently in the animation group.]]
return: list<Efl.Canvas.Animation>; [[List of animations in the group.]]
return: iterator<Efl.Canvas.Animation> @move; [[List of animations in the group.]]
}
}
implements {

View File

@ -13,15 +13,14 @@ _efl_canvas_animation_group_parallel_efl_canvas_animation_animation_apply(Eo *eo
int anim_repeated_count;
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
Eina_List *group_anim = efl_animation_group_animations_get(eo_obj);
Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
if (!group_anim) return progress;
group_length = efl_playable_length_get(eo_obj);
group_elapsed_time = group_length * progress;
Eina_List *l;
Efl_Canvas_Animation *anim;
EINA_LIST_FOREACH(group_anim, l, anim)
EINA_ITERATOR_FOREACH(group_anim, anim)
{
anim_length = efl_playable_length_get(anim);
anim_duration = efl_animation_duration_get(anim);
@ -48,6 +47,7 @@ _efl_canvas_animation_group_parallel_efl_canvas_animation_animation_apply(Eo *eo
efl_animation_apply(anim, anim_progress, target);
}
eina_iterator_free(group_anim);
return progress;
}
@ -58,18 +58,18 @@ _efl_canvas_animation_group_parallel_efl_canvas_animation_duration_get(const Eo
double child_total_duration;
double total_duration = 0.0;
Eina_List *animations = efl_animation_group_animations_get(eo_obj);
if (!animations) return 0.0;
Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
if (!group_anim) return 0.0;
Eina_List *l;
Efl_Canvas_Animation *anim;
EINA_LIST_FOREACH(animations, l, anim)
EINA_ITERATOR_FOREACH(group_anim, anim)
{
child_total_duration = efl_playable_length_get(anim);
child_total_duration += efl_animation_start_delay_get(anim);
if (child_total_duration > total_duration)
total_duration = child_total_duration;
}
eina_iterator_free(group_anim);
return total_duration;
}

View File

@ -15,15 +15,14 @@ _efl_canvas_animation_group_sequential_efl_canvas_animation_animation_apply(Eo *
int anim_repeated_count;
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
Eina_List *group_anim = efl_animation_group_animations_get(eo_obj);
Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
if (!group_anim) return progress;
group_length = efl_playable_length_get(eo_obj);
group_elapsed_time = group_length * progress;
Eina_List *l;
Efl_Canvas_Animation *anim;
EINA_LIST_FOREACH(group_anim, l, anim)
EINA_ITERATOR_FOREACH(group_anim, anim)
{
anim_start_delay = efl_animation_start_delay_get(anim);
anim_length = efl_playable_length_get(anim) + anim_start_delay;
@ -53,6 +52,7 @@ _efl_canvas_animation_group_sequential_efl_canvas_animation_animation_apply(Eo *
break;
}
eina_iterator_free(group_anim);
return progress;
}
@ -63,17 +63,17 @@ _efl_canvas_animation_group_sequential_efl_canvas_animation_duration_get(const E
double total_duration = 0.0;
double child_total_duration;
Eina_List *animations = efl_animation_group_animations_get(eo_obj);
if (!animations) return 0.0;
Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
if (!group_anim) return 0.0;
Eina_List *l;
Efl_Canvas_Animation *anim;
EINA_LIST_FOREACH(animations, l, anim)
EINA_ITERATOR_FOREACH(group_anim, anim)
{
child_total_duration = efl_playable_length_get(anim);
child_total_duration += efl_animation_start_delay_get(anim);
total_duration += child_total_duration;
}
eina_iterator_free(group_anim);
return total_duration;
}