summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2020-01-15 09:44:30 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-15 11:09:21 +0100
commit7661473f282f021fde1574f91fc8d6e7bf946382 (patch)
treeb3fbda540f6d9b560402ca5d517a55dae9e566c4
parent4386a70177f1516a8da96e522bd105d6e6dc2481 (diff)
efl_canvas_animation_group: preserve each animation's duration
To preserve each animation's duration, group animation's duration is copied to each animation's duration only if group animation's duration is set. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11104
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group.c15
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group_private.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group.c b/src/lib/evas/canvas/efl_canvas_animation_group.c
index b6a771501f..7dc7c24bb8 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_group.c
@@ -7,8 +7,14 @@ _efl_canvas_animation_group_animation_add(Eo *eo_obj,
7{ 7{
8 if (!animation) return; 8 if (!animation) return;
9 9
10 double duration = efl_animation_duration_get(efl_super(eo_obj, MY_CLASS)); 10 /* To preserve each animation's duration, group animation's duration is
11 efl_animation_duration_set(animation, duration); 11 * copied to each animation's duration only if group animation's duration is
12 * set. */
13 if (pd->is_duration_set)
14 {
15 double duration = efl_animation_duration_get(efl_super(eo_obj, MY_CLASS));
16 efl_animation_duration_set(animation, duration);
17 }
12 18
13 Eina_Bool keep_final_state = efl_animation_final_state_keep_get(eo_obj); 19 Eina_Bool keep_final_state = efl_animation_final_state_keep_get(eo_obj);
14 efl_animation_final_state_keep_set(animation, keep_final_state); 20 efl_animation_final_state_keep_set(animation, keep_final_state);
@@ -50,6 +56,8 @@ _efl_canvas_animation_group_efl_canvas_animation_duration_set(Eo *eo_obj,
50 Efl_Canvas_Animation_Group_Data *pd, 56 Efl_Canvas_Animation_Group_Data *pd,
51 double duration) 57 double duration)
52{ 58{
59 EINA_SAFETY_ON_FALSE_RETURN(duration >= 0.0);
60
53 efl_animation_duration_set(efl_super(eo_obj, MY_CLASS), duration); 61 efl_animation_duration_set(efl_super(eo_obj, MY_CLASS), duration);
54 duration = efl_animation_duration_get(eo_obj); 62 duration = efl_animation_duration_get(eo_obj);
55 63
@@ -59,6 +67,8 @@ _efl_canvas_animation_group_efl_canvas_animation_duration_set(Eo *eo_obj,
59 { 67 {
60 efl_animation_duration_set(anim, duration); 68 efl_animation_duration_set(anim, duration);
61 } 69 }
70
71 pd->is_duration_set = EINA_TRUE;
62} 72}
63 73
64EOLIAN static void 74EOLIAN static void
@@ -96,7 +106,6 @@ _efl_canvas_animation_group_efl_object_constructor(Eo *eo_obj,
96 Efl_Canvas_Animation_Group_Data *pd) 106 Efl_Canvas_Animation_Group_Data *pd)
97{ 107{
98 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 108 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
99
100 pd->animations = NULL; 109 pd->animations = NULL;
101 110
102 return eo_obj; 111 return eo_obj;
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group_private.h b/src/lib/evas/canvas/efl_canvas_animation_group_private.h
index 685e8f6063..335053d9c1 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group_private.h
+++ b/src/lib/evas/canvas/efl_canvas_animation_group_private.h
@@ -12,4 +12,5 @@
12typedef struct _Efl_Canvas_Animation_Group_Data 12typedef struct _Efl_Canvas_Animation_Group_Data
13{ 13{
14 Eina_List *animations; 14 Eina_List *animations;
15 Eina_Bool is_duration_set : 1; //EINA_TRUE if duration is set
15} Efl_Canvas_Animation_Group_Data; 16} Efl_Canvas_Animation_Group_Data;