summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_cubic_bezier_interpolator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ecore/efl_cubic_bezier_interpolator.c')
-rw-r--r--src/lib/ecore/efl_cubic_bezier_interpolator.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/lib/ecore/efl_cubic_bezier_interpolator.c b/src/lib/ecore/efl_cubic_bezier_interpolator.c
index 8b9b376..2413714 100644
--- a/src/lib/ecore/efl_cubic_bezier_interpolator.c
+++ b/src/lib/ecore/efl_cubic_bezier_interpolator.c
@@ -11,7 +11,7 @@ typedef struct _Efl_Cubic_Bezier_Interpolator_Data Efl_Cubic_Bezier_Interpolator
11 11
12struct _Efl_Cubic_Bezier_Interpolator_Data 12struct _Efl_Cubic_Bezier_Interpolator_Data
13{ 13{
14 double factor[4]; 14 double control_points[4];
15}; 15};
16 16
17EOLIAN static double 17EOLIAN static double
@@ -23,38 +23,36 @@ _efl_cubic_bezier_interpolator_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUS
23 return progress; 23 return progress;
24 24
25 return ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, 25 return ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4,
26 pd->factor); 26 pd->control_points);
27} 27}
28 28
29EOLIAN static void 29EOLIAN static void
30_efl_cubic_bezier_interpolator_factors_set(Eo *eo_obj EINA_UNUSED, 30_efl_cubic_bezier_interpolator_control_points_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Cubic_Bezier_Interpolator_Data *pd, 31 Efl_Cubic_Bezier_Interpolator_Data *pd,
32 double factor1, double factor2, 32 Eina_Vector2 p1, Eina_Vector2 p2)
33 double factor3, double factor4)
34{ 33{
35 pd->factor[0] = factor1; 34 pd->control_points[0] = p1.x;
36 pd->factor[1] = factor2; 35 pd->control_points[1] = p1.y;
37 pd->factor[2] = factor3; 36 pd->control_points[2] = p2.x;
38 pd->factor[3] = factor4; 37 pd->control_points[3] = p2.y;
39} 38}
40 39
41EOLIAN static void 40EOLIAN static void
42_efl_cubic_bezier_interpolator_factors_get(const Eo *eo_obj EINA_UNUSED, 41_efl_cubic_bezier_interpolator_control_points_get(const Eo *eo_obj EINA_UNUSED,
43 Efl_Cubic_Bezier_Interpolator_Data *pd, 42 Efl_Cubic_Bezier_Interpolator_Data *pd,
44 double *factor1, double *factor2, 43 Eina_Vector2 *p1, Eina_Vector2 *p2)
45 double *factor3, double *factor4)
46{ 44{
47 if (factor1) 45 if (p1)
48 *factor1 = pd->factor[0]; 46 {
47 p1->x = pd->control_points[0];
48 p1->y = pd->control_points[1];
49 }
49 50
50 if (factor2) 51 if (p2)
51 *factor2 = pd->factor[1]; 52 {
52 53 p2->x = pd->control_points[2];
53 if (factor3) 54 p2->y = pd->control_points[3];
54 *factor3 = pd->factor[2]; 55 }
55
56 if (factor4)
57 *factor4 = pd->factor[3];
58} 56}
59 57
60EOLIAN static Efl_Object * 58EOLIAN static Efl_Object *
@@ -63,10 +61,10 @@ _efl_cubic_bezier_interpolator_efl_object_constructor(Eo *eo_obj,
63{ 61{
64 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 62 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
65 63
66 pd->factor[0] = 1.0; 64 pd->control_points[0] = 1.0;
67 pd->factor[1] = 1.0; 65 pd->control_points[1] = 1.0;
68 pd->factor[2] = 1.0; 66 pd->control_points[2] = 1.0;
69 pd->factor[3] = 1.0; 67 pd->control_points[3] = 1.0;
70 68
71 return eo_obj; 69 return eo_obj;
72} 70}