summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_canvas_animation_scale.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas/efl_canvas_animation_scale.c')
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_scale.c134
1 files changed, 44 insertions, 90 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_animation_scale.c b/src/lib/evas/canvas/efl_canvas_animation_scale.c
index 1cccbc6..e8a1323 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_scale.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_scale.c
@@ -5,37 +5,26 @@
5EOLIAN static void 5EOLIAN static void
6_efl_canvas_animation_scale_scale_set(Eo *eo_obj EINA_UNUSED, 6_efl_canvas_animation_scale_scale_set(Eo *eo_obj EINA_UNUSED,
7 Efl_Canvas_Animation_Scale_Data *pd, 7 Efl_Canvas_Animation_Scale_Data *pd,
8 double from_scale_x, 8 Eina_Vector2 from_scale,
9 double from_scale_y, 9 Eina_Vector2 to_scale,
10 double to_scale_x,
11 double to_scale_y,
12 Efl_Canvas_Object *pivot, 10 Efl_Canvas_Object *pivot,
13 double cx, 11 Eina_Vector2 rel_pivot_pos)
14 double cy)
15{ 12{
16 pd->from.scale_x = from_scale_x; 13 pd->from = from_scale;
17 pd->from.scale_y = from_scale_y;
18 14
19 pd->to.scale_x = to_scale_x; 15 pd->to = to_scale;
20 pd->to.scale_y = to_scale_y;
21 16
22 pd->rel_pivot.obj = pivot; 17 pd->rel_pivot.obj = pivot;
23 pd->rel_pivot.cx = cx; 18 pd->rel_pivot.pos = rel_pivot_pos;
24 pd->rel_pivot.cy = cy;
25 19
26 pd->use_rel_pivot = EINA_TRUE; 20 pd->use_rel_pivot = EINA_TRUE;
27} 21}
28 22
29EOLIAN static void 23EOLIAN static void
30_efl_canvas_animation_scale_scale_get(const Eo *eo_obj EINA_UNUSED, 24_efl_canvas_animation_scale_scale_get(const Eo *obj EINA_UNUSED,
31 Efl_Canvas_Animation_Scale_Data *pd, 25 Efl_Canvas_Animation_Scale_Data *pd,
32 double *from_scale_x, 26 Eina_Vector2 *from_scale, Eina_Vector2 *to_scale,
33 double *from_scale_y, 27 Efl_Canvas_Object **pivot, Eina_Vector2 *pivot_pos)
34 double *to_scale_x,
35 double *to_scale_y,
36 Efl_Canvas_Object **pivot,
37 double *cx,
38 double *cy)
39{ 28{
40 if (!pd->use_rel_pivot) 29 if (!pd->use_rel_pivot)
41 { 30 {
@@ -43,59 +32,39 @@ _efl_canvas_animation_scale_scale_get(const Eo *eo_obj EINA_UNUSED,
43 return; 32 return;
44 } 33 }
45 34
46 if (from_scale_x) 35 if (from_scale)
47 *from_scale_x = pd->from.scale_x; 36 *from_scale = pd->from;
48
49 if (from_scale_y)
50 *from_scale_y = pd->from.scale_y;
51
52 if (to_scale_x)
53 *to_scale_x = pd->to.scale_x;
54 37
55 if (to_scale_y) 38 if (to_scale)
56 *to_scale_y = pd->to.scale_y; 39 *to_scale = pd->to;
57 40
58 if (pivot) 41 if (pivot)
59 *pivot = pd->rel_pivot.obj; 42 *pivot = pd->rel_pivot.obj;
60 43
61 if (cx) 44 if (pivot_pos)
62 *cx = pd->rel_pivot.cx; 45 *pivot_pos = pd->rel_pivot.pos;
63
64 if (cy)
65 *cy = pd->rel_pivot.cy;
66} 46}
67 47
68EOLIAN static void 48EOLIAN static void
69_efl_canvas_animation_scale_scale_absolute_set(Eo *eo_obj EINA_UNUSED, 49_efl_canvas_animation_scale_scale_absolute_set(Eo *obj EINA_UNUSED,
70 Efl_Canvas_Animation_Scale_Data *pd, 50 Efl_Canvas_Animation_Scale_Data *pd,
71 double from_scale_x, 51 Eina_Vector2 from_scale, Eina_Vector2 to_scale,
72 double from_scale_y, 52 Eina_Position2D pos)
73 double to_scale_x,
74 double to_scale_y,
75 Evas_Coord cx,
76 Evas_Coord cy)
77{ 53{
78 pd->from.scale_x = from_scale_x; 54 pd->from = from_scale;
79 pd->from.scale_y = from_scale_y;
80 55
81 pd->to.scale_x = to_scale_x; 56 pd->to = to_scale;
82 pd->to.scale_y = to_scale_y;
83 57
84 pd->abs_pivot.cx = cx; 58 pd->pos = pos;
85 pd->abs_pivot.cy = cy;
86 59
87 pd->use_rel_pivot = EINA_FALSE; 60 pd->use_rel_pivot = EINA_FALSE;
88} 61}
89 62
90EOLIAN static void 63EOLIAN static void
91_efl_canvas_animation_scale_scale_absolute_get(const Eo *eo_obj EINA_UNUSED, 64_efl_canvas_animation_scale_scale_absolute_get(const Eo *obj EINA_UNUSED,
92 Efl_Canvas_Animation_Scale_Data *pd, 65 Efl_Canvas_Animation_Scale_Data *pd,
93 double *from_scale_x, 66 Eina_Vector2 *from_scale, Eina_Vector2 *to_scale,
94 double *from_scale_y, 67 Eina_Position2D *pos)
95 double *to_scale_x,
96 double *to_scale_y,
97 Evas_Coord *cx,
98 Evas_Coord *cy)
99{ 68{
100 if (pd->use_rel_pivot) 69 if (pd->use_rel_pivot)
101 { 70 {
@@ -103,23 +72,14 @@ _efl_canvas_animation_scale_scale_absolute_get(const Eo *eo_obj EINA_UNUSED,
103 return; 72 return;
104 } 73 }
105 74
106 if (from_scale_x) 75 if (from_scale)
107 *from_scale_x = pd->from.scale_x; 76 *from_scale = pd->from;
108
109 if (from_scale_y)
110 *from_scale_y = pd->from.scale_y;
111 77
112 if (to_scale_x) 78 if (to_scale)
113 *to_scale_x = pd->to.scale_x; 79 *to_scale = pd->to;
114 80
115 if (to_scale_y) 81 if (pos)
116 *to_scale_y = pd->to.scale_y; 82 *pos = pd->pos;
117
118 if (cx)
119 *cx = pd->abs_pivot.cx;
120
121 if (cy)
122 *cy = pd->abs_pivot.cy;
123} 83}
124 84
125EOLIAN static double 85EOLIAN static double
@@ -128,26 +88,26 @@ _efl_canvas_animation_scale_efl_canvas_animation_animation_apply(Eo *eo_obj,
128 double progress, 88 double progress,
129 Efl_Canvas_Object *target) 89 Efl_Canvas_Object *target)
130{ 90{
131 Efl_Canvas_Animation_Scale_Property new_scale; 91 Eina_Vector2 new_scale;
132 92
133 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target); 93 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
134 if (!target) return progress; 94 if (!target) return progress;
135 95
136 new_scale.scale_x = GET_STATUS(pd->from.scale_x, pd->to.scale_x, progress); 96 new_scale.x = GET_STATUS(pd->from.x, pd->to.x, progress);
137 new_scale.scale_y = GET_STATUS(pd->from.scale_y, pd->to.scale_y, progress); 97 new_scale.y = GET_STATUS(pd->from.y, pd->to.y, progress);
138 98
139 if (pd->use_rel_pivot) 99 if (pd->use_rel_pivot)
140 { 100 {
141 efl_gfx_mapping_zoom(target, 101 efl_gfx_mapping_zoom(target,
142 new_scale.scale_x, new_scale.scale_y, 102 new_scale.x, new_scale.y,
143 (pd->rel_pivot.obj) ? pd->rel_pivot.obj : target, 103 (pd->rel_pivot.obj) ? pd->rel_pivot.obj : target,
144 pd->rel_pivot.cx, pd->rel_pivot.cy); 104 pd->rel_pivot.pos.x , pd->rel_pivot.pos.y);
145 } 105 }
146 else 106 else
147 { 107 {
148 efl_gfx_mapping_zoom_absolute(target, 108 efl_gfx_mapping_zoom_absolute(target,
149 new_scale.scale_x, new_scale.scale_y, 109 new_scale.x, new_scale.y,
150 pd->abs_pivot.cx, pd->abs_pivot.cy); 110 pd->pos.x, pd->pos.y);
151 } 111 }
152 112
153 return progress; 113 return progress;
@@ -159,17 +119,11 @@ _efl_canvas_animation_scale_efl_object_constructor(Eo *eo_obj,
159{ 119{
160 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 120 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
161 121
162 pd->from.scale_x = 1.0; 122 pd->from = EINA_VECTOR2(1.0, 1.0);
163 pd->from.scale_y = 1.0; 123 pd->to = EINA_VECTOR2(1.0, 1.0);
164 pd->to.scale_x = 1.0; 124 pd->rel_pivot.pos = EINA_VECTOR2(0.5, 0.5);
165 pd->to.scale_y = 1.0;
166
167 pd->rel_pivot.obj = NULL; 125 pd->rel_pivot.obj = NULL;
168 pd->rel_pivot.cx = 0.5; 126 pd->pos = EINA_POSITION2D(0, 0);
169 pd->rel_pivot.cy = 0.5;
170
171 pd->abs_pivot.cx = 0;
172 pd->abs_pivot.cy = 0;
173 127
174 pd->use_rel_pivot = EINA_TRUE; 128 pd->use_rel_pivot = EINA_TRUE;
175 129