summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-10-30 15:30:20 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2019-11-04 13:06:53 +0100
commita1a77f5590a27ba6bb70ce9d2f5343f3cddc96dc (patch)
tree68969906e2691c0c1e67b75ace3a9bc3a3f020b7
parente2a011f56b48d7894e710fca5a46a4bfe87ecd1f (diff)
efl_canvas_animation_translate: move from x&y to container types
Summary: this now uses Eina.Position2D so its easier to pass arround other positions. ref T8288 Depends on D10559 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8288 Differential Revision: https://phab.enlightenment.org/D10562
-rw-r--r--src/bin/elementary/test_efl_anim_interpolator.c2
-rw-r--r--src/bin/elementary/test_efl_anim_translate.c8
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_translate.c75
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_translate.eo12
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_translate_private.h10
5 files changed, 35 insertions, 72 deletions
diff --git a/src/bin/elementary/test_efl_anim_interpolator.c b/src/bin/elementary/test_efl_anim_interpolator.c
index be177d7ed4..9a6522f6d7 100644
--- a/src/bin/elementary/test_efl_anim_interpolator.c
+++ b/src/bin/elementary/test_efl_anim_interpolator.c
@@ -199,7 +199,7 @@ test_efl_anim_interpolator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
199 199
200 Efl_Canvas_Animation *anim = 200 Efl_Canvas_Animation *anim =
201 efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win); 201 efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
202 efl_animation_translate_set(anim, 0, 0, (WIN_W - BTN_W), 0); 202 efl_animation_translate_set(anim, EINA_POSITION2D(0, 0), EINA_POSITION2D((WIN_W - BTN_W), 0));
203 efl_animation_duration_set(anim, 2.0); 203 efl_animation_duration_set(anim, 2.0);
204 efl_animation_final_state_keep_set(anim, EINA_FALSE); 204 efl_animation_final_state_keep_set(anim, EINA_FALSE);
205 205
diff --git a/src/bin/elementary/test_efl_anim_translate.c b/src/bin/elementary/test_efl_anim_translate.c
index 9f30cc3b63..5bbf1b22e7 100644
--- a/src/bin/elementary/test_efl_anim_translate.c
+++ b/src/bin/elementary/test_efl_anim_translate.c
@@ -84,13 +84,13 @@ test_efl_anim_translate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
84 84
85 //Translate Animation to right bottom relatively 85 //Translate Animation to right bottom relatively
86 Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win); 86 Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
87 efl_animation_translate_set(translate_rb_anim, 0, 0, 100, 100); 87 efl_animation_translate_set(translate_rb_anim, EINA_POSITION2D(0, 0), EINA_POSITION2D(100, 100));
88 efl_animation_duration_set(translate_rb_anim, 1.0); 88 efl_animation_duration_set(translate_rb_anim, 1.0);
89 efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE); 89 efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE);
90 90
91 //Translate Animation to left top relatively 91 //Translate Animation to left top relatively
92 Efl_Canvas_Animation *translate_lt_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win); 92 Efl_Canvas_Animation *translate_lt_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
93 efl_animation_translate_set(translate_lt_anim, 100, 100, 0, 0); 93 efl_animation_translate_set(translate_lt_anim, EINA_POSITION2D(100, 100), EINA_POSITION2D(0, 0));
94 efl_animation_duration_set(translate_lt_anim, 1.0); 94 efl_animation_duration_set(translate_lt_anim, 1.0);
95 efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE); 95 efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE);
96 96
@@ -150,13 +150,13 @@ test_efl_anim_translate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_U
150 150
151 //Translate Animation to right bottom absolutely 151 //Translate Animation to right bottom absolutely
152 Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win); 152 Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
153 efl_animation_translate_absolute_set(translate_rb_anim, 0, 0, 100, 100); 153 efl_animation_translate_absolute_set(translate_rb_anim, EINA_POSITION2D(0, 0), EINA_POSITION2D(100, 100));
154 efl_animation_duration_set(translate_rb_anim, 1.0); 154 efl_animation_duration_set(translate_rb_anim, 1.0);
155 efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE); 155 efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE);
156 156
157 //Translate Animation to left top absolutely 157 //Translate Animation to left top absolutely
158 Efl_Canvas_Animation *translate_lt_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win); 158 Efl_Canvas_Animation *translate_lt_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
159 efl_animation_translate_absolute_set(translate_lt_anim, 100, 100, 0, 0); 159 efl_animation_translate_absolute_set(translate_lt_anim, EINA_POSITION2D(100, 100), EINA_POSITION2D(0, 0));
160 efl_animation_duration_set(translate_lt_anim, 1.0); 160 efl_animation_duration_set(translate_lt_anim, 1.0);
161 efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE); 161 efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE);
162 162
diff --git a/src/lib/evas/canvas/efl_canvas_animation_translate.c b/src/lib/evas/canvas/efl_canvas_animation_translate.c
index 39a052cf26..1a98daa60d 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_translate.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_translate.c
@@ -11,16 +11,12 @@ typedef struct __Translate_Property_Double
11EOLIAN static void 11EOLIAN static void
12_efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED, 12_efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
13 Efl_Canvas_Animation_Translate_Data *pd, 13 Efl_Canvas_Animation_Translate_Data *pd,
14 Evas_Coord from_x, 14 Eina_Position2D from,
15 Evas_Coord from_y, 15 Eina_Position2D to)
16 Evas_Coord to_x,
17 Evas_Coord to_y)
18{ 16{
19 pd->from.move_x = from_x; 17 pd->from = from;
20 pd->from.move_y = from_y;
21 18
22 pd->to.move_x = to_x; 19 pd->to = to;
23 pd->to.move_y = to_y;
24 20
25 pd->use_rel_move = EINA_TRUE; 21 pd->use_rel_move = EINA_TRUE;
26} 22}
@@ -28,10 +24,8 @@ _efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
28EOLIAN static void 24EOLIAN static void
29_efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED, 25_efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED,
30 Efl_Canvas_Animation_Translate_Data *pd, 26 Efl_Canvas_Animation_Translate_Data *pd,
31 Evas_Coord *from_x, 27 Eina_Position2D *from,
32 Evas_Coord *from_y, 28 Eina_Position2D *to)
33 Evas_Coord *to_x,
34 Evas_Coord *to_y)
35{ 29{
36 if (!pd->use_rel_move) 30 if (!pd->use_rel_move)
37 { 31 {
@@ -39,30 +33,22 @@ _efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED,
39 return; 33 return;
40 } 34 }
41 35
42 if (from_x) 36 if (from)
43 *from_x = pd->from.move_x; 37 *from = pd->from;
44 if (from_y)
45 *from_y = pd->from.move_y;
46 38
47 if (to_x) 39 if (to)
48 *to_x = pd->to.move_x; 40 *to = pd->to;
49 if (to_y)
50 *to_y = pd->to.move_y;
51} 41}
52 42
53EOLIAN static void 43EOLIAN static void
54_efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED, 44_efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED,
55 Efl_Canvas_Animation_Translate_Data *pd, 45 Efl_Canvas_Animation_Translate_Data *pd,
56 Evas_Coord from_x, 46 Eina_Position2D from,
57 Evas_Coord from_y, 47 Eina_Position2D to)
58 Evas_Coord to_x,
59 Evas_Coord to_y)
60{ 48{
61 pd->from.x = from_x; 49 pd->from = from;
62 pd->from.y = from_y;
63 50
64 pd->to.x = to_x; 51 pd->to = to;
65 pd->to.y = to_y;
66 52
67 pd->use_rel_move = EINA_FALSE; 53 pd->use_rel_move = EINA_FALSE;
68} 54}
@@ -70,10 +56,8 @@ _efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED,
70EOLIAN static void 56EOLIAN static void
71_efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNUSED, 57_efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNUSED,
72 Efl_Canvas_Animation_Translate_Data *pd, 58 Efl_Canvas_Animation_Translate_Data *pd,
73 Evas_Coord *from_x, 59 Eina_Position2D *from,
74 Evas_Coord *from_y, 60 Eina_Position2D *to)
75 Evas_Coord *to_x,
76 Evas_Coord *to_y)
77{ 61{
78 if (pd->use_rel_move) 62 if (pd->use_rel_move)
79 { 63 {
@@ -81,15 +65,11 @@ _efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNU
81 return; 65 return;
82 } 66 }
83 67
84 if (from_x) 68 if (from)
85 *from_x = pd->from.x; 69 *from = pd->from;
86 if (from_y)
87 *from_y = pd->from.y;
88 70
89 if (to_x) 71 if (to)
90 *to_x = pd->to.x; 72 *to = pd->to;
91 if (to_y)
92 *to_y = pd->to.y;
93} 73}
94 74
95EOLIAN static double 75EOLIAN static double
@@ -106,8 +86,8 @@ _efl_canvas_animation_translate_efl_canvas_animation_animation_apply(Eo *eo_obj,
106 86
107 if (pd->use_rel_move) 87 if (pd->use_rel_move)
108 { 88 {
109 new.x = GET_STATUS(pd->from.move_x, pd->to.move_x, progress); 89 new.x = GET_STATUS(pd->from.x, pd->to.x, progress);
110 new.y = GET_STATUS(pd->from.move_y, pd->to.move_y, progress); 90 new.y = GET_STATUS(pd->from.y, pd->to.y, progress);
111 } 91 }
112 else 92 else
113 { 93 {
@@ -127,15 +107,8 @@ _efl_canvas_animation_translate_efl_object_constructor(Eo *eo_obj,
127{ 107{
128 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 108 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
129 109
130 pd->from.move_x = 0; 110 pd->from = EINA_POSITION2D(0,0);
131 pd->from.move_y = 0; 111 pd->to = EINA_POSITION2D(0,0);
132 pd->from.x = 0;
133 pd->from.y = 0;
134
135 pd->to.move_x = 0;
136 pd->to.move_y = 0;
137 pd->to.x = 0;
138 pd->to.y = 0;
139 112
140 pd->use_rel_move = EINA_TRUE; 113 pd->use_rel_move = EINA_TRUE;
141 114
diff --git a/src/lib/evas/canvas/efl_canvas_animation_translate.eo b/src/lib/evas/canvas/efl_canvas_animation_translate.eo
index 3d74cbd0cd..e4b2678679 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_translate.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_translate.eo
@@ -11,10 +11,8 @@ class @beta Efl.Canvas.Animation_Translate extends Efl.Canvas.Animation
11 get { 11 get {
12 } 12 }
13 values { 13 values {
14 from_x: int; [[Distance moved along x axis when animation starts]] 14 from : Eina.Position2D; [[Position moved when animation starts.]]
15 from_y: int; [[Distance moved along y axis when animation starts]] 15 to : Eina.Position2D; [[Position moved when animation ends.]]
16 to_x: int; [[Distance moved along x axis when animation ends]]
17 to_y: int; [[Distance moved along y axis when animation ends]]
18 } 16 }
19 } 17 }
20 @property translate_absolute { 18 @property translate_absolute {
@@ -24,10 +22,8 @@ class @beta Efl.Canvas.Animation_Translate extends Efl.Canvas.Animation
24 get { 22 get {
25 } 23 }
26 values { 24 values {
27 from_x: int; [[X coordinate when animation starts]] 25 from : Eina.Position2D; [[The position where the animation starts.]]
28 from_y: int; [[Y coordinate when animation starts]] 26 to : Eina.Position2D; [[The position where the animation stops.]]
29 to_x: int; [[X coordinate when animation ends]]
30 to_y: int; [[Y coordinate when animation ends]]
31 } 27 }
32 } 28 }
33 } 29 }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_translate_private.h b/src/lib/evas/canvas/efl_canvas_animation_translate_private.h
index 17c4b6d432..47665a5984 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_translate_private.h
+++ b/src/lib/evas/canvas/efl_canvas_animation_translate_private.h
@@ -7,16 +7,10 @@
7#define EFL_ANIMATION_TRANSLATE_DATA_GET(o, pd) \ 7#define EFL_ANIMATION_TRANSLATE_DATA_GET(o, pd) \
8 Efl_Canvas_Animation_Translate_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_TRANSLATE_CLASS) 8 Efl_Canvas_Animation_Translate_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_TRANSLATE_CLASS)
9 9
10typedef struct _Efl_Canvas_Animation_Translate_Property
11{
12 Evas_Coord move_x, move_y;
13 Evas_Coord x, y;
14} Efl_Canvas_Animation_Translate_Property;
15
16typedef struct _Efl_Canvas_Animation_Translate_Data 10typedef struct _Efl_Canvas_Animation_Translate_Data
17{ 11{
18 Efl_Canvas_Animation_Translate_Property from; 12 Eina_Position2D from;
19 Efl_Canvas_Animation_Translate_Property to; 13 Eina_Position2D to;
20 14
21 Eina_Bool use_rel_move; 15 Eina_Bool use_rel_move;
22} Efl_Canvas_Animation_Translate_Data; 16} Efl_Canvas_Animation_Translate_Data;