Eina Vector2: Move EAPI to static inline 84/170584/1
authorJean-Philippe Andre <jp.andre@samsung.com>
Thu, 7 Jan 2016 08:57:44 +0000 (17:57 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Wed, 21 Feb 2018 03:02:50 +0000 (12:02 +0900)
This removes lots of unnecessary symbols

Change-Id: I41f88adc4cac3313628833ab0f85a0e1a735807f

src/Makefile_Eina.am
src/lib/eina/eina_vector.c [deleted file]
src/lib/eina/eina_vector.h

index 2302d86..2e25fed 100644 (file)
@@ -165,7 +165,6 @@ lib/eina/eina_private.h \
 lib/eina/eina_share_common.h \
 lib/eina/eina_strbuf_common.h \
 lib/eina/eina_quaternion.c \
-lib/eina/eina_vector.c \
 lib/eina/eina_bezier.c
 
 if HAVE_WIN32
diff --git a/src/lib/eina/eina_vector.c b/src/lib/eina/eina_vector.c
deleted file mode 100644 (file)
index d2338ce..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/* EINA - EFL data type library
- * Copyright (C) 2008 Cedric Bail
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library;
- * if not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "eina_private.h"
-
-#include <math.h>
-#include <float.h>
-
-#include "eina_fp.h"
-#include "eina_matrix.h"
-#include "eina_vector.h"
-
-EAPI void
-eina_vector2_set(Eina_Vector2 *dst, double x, double y)
-{
-   dst->x = x;
-   dst->y = y;
-}
-
-EAPI void
-eina_vector2_array_set(Eina_Vector2 *dst, const double *v)
-{
-   dst->x = v[0];
-   dst->y = v[1];
-}
-
-EAPI void
-eina_vector2_copy(Eina_Vector2 *dst, const Eina_Vector2 *src)
-{
-   dst->x = src->x;
-   dst->y = src->y;
-}
-
-EAPI void
-eina_vector2_negate(Eina_Vector2 *out, const Eina_Vector2 *v)
-{
-   out->x = -v->x;
-   out->y = -v->y;
-}
-
-EAPI void
-eina_vector2_add(Eina_Vector2 *out, const Eina_Vector2 *a, const Eina_Vector2 *b)
-{
-   out->x = a->x + b->x;
-   out->y = a->y + b->y;
-}
-
-EAPI void
-eina_vector2_subtract(Eina_Vector2 *out, const Eina_Vector2 *a, const Eina_Vector2 *b)
-{
-   out->x = a->x - b->x;
-   out->y = a->y - b->y;
-}
-
-EAPI void
-eina_vector2_scale(Eina_Vector2 *out, const Eina_Vector2 *v, double scale)
-{
-   out->x = scale * v->x;
-   out->y = scale * v->y;
-}
-
-EAPI double
-eina_vector2_dot_product(const Eina_Vector2 *a, const Eina_Vector2 *b)
-{
-   return (a->x * b->x) + (a->y * b->y);
-}
-
-EAPI double
-eina_vector2_length_get(const Eina_Vector2 *v)
-{
-   return (double)sqrt((double)((v->x * v->x) + (v->y * v->y)));
-}
-
-EAPI double
-eina_vector2_length_square_get(const Eina_Vector2 *v)
-{
-   return (v->x * v->x) + (v->y * v->y);
-}
-
-EAPI double
-eina_vector2_distance_get(const Eina_Vector2 *a, const Eina_Vector2 *b)
-{
-   Eina_Vector2 v;
-
-   eina_vector2_subtract(&v, a, b);
-   return eina_vector2_length_get(&v);
-}
-
-EAPI double
-eina_vector2_distance_square_get(const Eina_Vector2 *a, const Eina_Vector2 *b)
-{
-   Eina_Vector2 v;
-
-   eina_vector2_subtract(&v, a, b);
-   return eina_vector2_length_square_get(&v);
-}
-
-EAPI void
-eina_vector2_normalize(Eina_Vector2 *out, const Eina_Vector2 *v)
-{
-   /* Assume "v" is not a zero vector */
-   eina_vector2_scale(out, v, 1.0 / eina_vector2_length_get(v));
-}
-
-EAPI void
-eina_vector2_transform(Eina_Vector2 *out, const Eina_Matrix2 *m, const Eina_Vector2 *v)
-{
-   Eina_Vector2 tmp;
-
-   tmp.x = (m->xx * v->x) + (m->yx * v->y);
-   tmp.y = (m->xy * v->x) + (m->yy * v->y);
-
-   eina_vector2_copy(out, &tmp);
-}
-
-EAPI void
-eina_vector2_homogeneous_position_transform(Eina_Vector2 *out, const Eina_Matrix3 *m,
-                                            const Eina_Vector2 *v)
-{
-   Eina_Vector2 tmp;
-
-   tmp.x = (m->xx * v->x) + (m->yx * v->y) + m->zx;
-   tmp.y = (m->xy * v->x) + (m->yy * v->y) + m->zy;
-
-   eina_vector2_scale(out, &tmp, 1.0 / ((m->xz * v->x) + (m->yz * v->y) + m->zz));
-}
-
-EAPI void
-eina_vector2_homogeneous_direction_transform(Eina_Vector2 *out, const Eina_Matrix3 *m,
-                                             const Eina_Vector2 *v)
-{
-   Eina_Vector2 tmp;
-
-   tmp.x = (m->xx * v->x) + (m->yx * v->y);
-   tmp.y = (m->xy * v->x) + (m->yy * v->y);
-
-   eina_vector2_copy(out, &tmp);
-}
index aa32e32..926aa34 100644 (file)
@@ -1,5 +1,5 @@
 /* EINA - EFL data type library
- * Copyright (C) 2008 Cedric Bail
+ * Copyright (C) 2015 Cedric Bail
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,8 @@
 #ifndef EINA_VECTOR_H_
 #define EINA_VECTOR_H_
 
+#include "eina_matrix.h"
+
 /**
  * @file
  * @ender_group{Eina_Vector_Type}
@@ -50,7 +52,12 @@ struct _Eina_Vector2
  *
  * @since 1.17
  */
-EAPI void eina_vector2_set(Eina_Vector2 *dst, double x, double y);
+static inline void
+eina_vector2_set(Eina_Vector2 *dst, double x, double y)
+{
+   dst->x = x;
+   dst->y = y;
+}
 
 /**
  * @brief Set array to vector.
@@ -62,7 +69,12 @@ EAPI void eina_vector2_set(Eina_Vector2 *dst, double x, double y);
  *
  * @since 1.17
  */
-EAPI void eina_vector2_array_set(Eina_Vector2 *dst, const double *v);
+static inline void
+eina_vector2_array_set(Eina_Vector2 *dst, const double *v)
+{
+   dst->x = v[0];
+   dst->y = v[1];
+}
 
 /**
  * @brief Copy vector.
@@ -72,7 +84,12 @@ EAPI void eina_vector2_array_set(Eina_Vector2 *dst, const double *v);
  *
  * @since 1.17
  */
-EAPI void eina_vector2_copy(Eina_Vector2 *dst, const Eina_Vector2 *src);
+static inline void
+eina_vector2_copy(Eina_Vector2 *dst, const Eina_Vector2 *src)
+{
+   dst->x = src->x;
+   dst->y = src->y;
+}
 
 /**
  * @brief Make negative vector.
@@ -82,7 +99,12 @@ EAPI void eina_vector2_copy(Eina_Vector2 *dst, const Eina_Vector2 *src);
  *
  * @since 1.17
  */
-EAPI void eina_vector2_negate(Eina_Vector2 *out, const Eina_Vector2 *v);
+static inline void
+eina_vector2_negate(Eina_Vector2 *out, const Eina_Vector2 *v)
+{
+   out->x = -v->x;
+   out->y = -v->y;
+}
 
 /**
  * @brief Add two vectors.
@@ -93,8 +115,13 @@ EAPI void eina_vector2_negate(Eina_Vector2 *out, const Eina_Vector2 *v);
  *
  * @since 1.17
  */
-EAPI void eina_vector2_add(Eina_Vector2 *out, const Eina_Vector2 *a,
-                           const Eina_Vector2 *b);
+static inline void
+eina_vector2_add(Eina_Vector2 *out, const Eina_Vector2 *a,
+                 const Eina_Vector2 *b)
+{
+   out->x = a->x + b->x;
+   out->y = a->y + b->y;
+}
 
 /**
  * @brief Subtract two vectors
@@ -105,8 +132,13 @@ EAPI void eina_vector2_add(Eina_Vector2 *out, const Eina_Vector2 *a,
  *
  * @since 1.17
  */
-EAPI void eina_vector2_subtract(Eina_Vector2 *out, const Eina_Vector2 *a,
-                                const Eina_Vector2 *b);
+static inline void
+eina_vector2_subtract(Eina_Vector2 *out, const Eina_Vector2 *a,
+                      const Eina_Vector2 *b)
+{
+   out->x = a->x - b->x;
+   out->y = a->y - b->y;
+}
 
 /**
  * @brief Scale vector.
@@ -117,7 +149,12 @@ EAPI void eina_vector2_subtract(Eina_Vector2 *out, const Eina_Vector2 *a,
  *
  * @since 1.17
  */
-EAPI void eina_vector2_scale(Eina_Vector2 *out, const Eina_Vector2 *v, double scale);
+static inline void
+eina_vector2_scale(Eina_Vector2 *out, const Eina_Vector2 *v, double scale)
+{
+   out->x = scale * v->x;
+   out->y = scale * v->y;
+}
 
 /**
  * @brief Return the dot product of the two vectors.
@@ -128,7 +165,11 @@ EAPI void eina_vector2_scale(Eina_Vector2 *out, const Eina_Vector2 *v, double sc
  *
  * @since 1.17
  */
-EAPI double eina_vector2_dot_product(const Eina_Vector2 *a, const Eina_Vector2 *b);
+static inline double
+eina_vector2_dot_product(const Eina_Vector2 *a, const Eina_Vector2 *b)
+{
+   return (a->x * b->x) + (a->y * b->y);
+}
 
 /**
  * @brief Return the length of the given vector.
@@ -138,7 +179,11 @@ EAPI double eina_vector2_dot_product(const Eina_Vector2 *a, const Eina_Vector2 *
  *
  * @since 1.17
  */
-EAPI double eina_vector2_length_get(const Eina_Vector2 *v);
+static inline double
+eina_vector2_length_get(const Eina_Vector2 *v)
+{
+   return sqrt((v->x * v->x) + (v->y * v->y));
+}
 
 /**
  * @brief Return the length in square of the given vector.
@@ -148,7 +193,11 @@ EAPI double eina_vector2_length_get(const Eina_Vector2 *v);
  *
  * @since 1.17
  */
-EAPI double eina_vector2_length_square_get(const Eina_Vector2 *v);
+static inline double
+eina_vector2_length_square_get(const Eina_Vector2 *v)
+{
+   return (v->x * v->x) + (v->y * v->y);
+}
 
 /**
  * @brief Return the distance between of two vectors.
@@ -159,7 +208,14 @@ EAPI double eina_vector2_length_square_get(const Eina_Vector2 *v);
  *
  * @since 1.17
  */
-EAPI double eina_vector2_distance_get(const Eina_Vector2 *a, const Eina_Vector2 *b);
+static inline double
+eina_vector2_distance_get(const Eina_Vector2 *a, const Eina_Vector2 *b)
+{
+   Eina_Vector2 v;
+
+   eina_vector2_subtract(&v, a, b);
+   return eina_vector2_length_get(&v);
+}
 
 /**
  * @brief Return the distance in square between of two vectors.
@@ -170,8 +226,14 @@ EAPI double eina_vector2_distance_get(const Eina_Vector2 *a, const Eina_Vector2
  *
  * @since 1.17
  */
-EAPI double eina_vector2_distance_square_get(const Eina_Vector2 *a,
-                                             const Eina_Vector2 *b);
+static inline double
+eina_vector2_distance_square_get(const Eina_Vector2 *a, const Eina_Vector2 *b)
+{
+   Eina_Vector2 v;
+
+   eina_vector2_subtract(&v, a, b);
+   return eina_vector2_length_square_get(&v);
+}
 
 /**
  * @brief normalize vector.
@@ -181,7 +243,12 @@ EAPI double eina_vector2_distance_square_get(const Eina_Vector2 *a,
  *
  * @since 1.17
  */
-EAPI void eina_vector2_normalize(Eina_Vector2 *out, const Eina_Vector2 *v);
+static inline void
+eina_vector2_normalize(Eina_Vector2 *out, const Eina_Vector2 *v)
+{
+   /* Assume "v" is not a zero vector */
+   eina_vector2_scale(out, v, 1.0 / eina_vector2_length_get(v));
+}
 
 /**
  * @brief Transform vector.
@@ -192,8 +259,17 @@ EAPI void eina_vector2_normalize(Eina_Vector2 *out, const Eina_Vector2 *v);
  *
  * @since 1.17
  */
-EAPI void eina_vector2_transform(Eina_Vector2 *out, const Eina_Matrix2 *m,
-                                 const Eina_Vector2 *v);
+static inline void
+eina_vector2_transform(Eina_Vector2 *out, const Eina_Matrix2 *m,
+                       const Eina_Vector2 *v)
+{
+   Eina_Vector2 tmp;
+
+   tmp.x = (m->xx * v->x) + (m->yx * v->y);
+   tmp.y = (m->xy * v->x) + (m->yy * v->y);
+
+   eina_vector2_copy(out, &tmp);
+}
 
 /**
  * @brief Homogeneous position transform vector.
@@ -204,9 +280,18 @@ EAPI void eina_vector2_transform(Eina_Vector2 *out, const Eina_Matrix2 *m,
  *
  * @since 1.17
  */
-EAPI void eina_vector2_homogeneous_position_transform(Eina_Vector2 *out,
-                                                      const Eina_Matrix3 *m,
-                                                      const Eina_Vector2 *v);
+static inline void
+eina_vector2_homogeneous_position_transform(Eina_Vector2 *out,
+                                            const Eina_Matrix3 *m,
+                                            const Eina_Vector2 *v)
+{
+   Eina_Vector2 tmp;
+
+   tmp.x = (m->xx * v->x) + (m->yx * v->y) + m->zx;
+   tmp.y = (m->xy * v->x) + (m->yy * v->y) + m->zy;
+
+   eina_vector2_scale(out, &tmp, 1.0 / ((m->xz * v->x) + (m->yz * v->y) + m->zz));
+}
 
 /**
  * @brief Homogeneous direction ransform vector.
@@ -217,8 +302,17 @@ EAPI void eina_vector2_homogeneous_position_transform(Eina_Vector2 *out,
  *
  * @since 1.17
  */
-EAPI void eina_vector2_homogeneous_direction_transform(Eina_Vector2 *out,
-                                                       const Eina_Matrix3 *m,
-                                                       const Eina_Vector2 *v);
+static inline void
+eina_vector2_homogeneous_direction_transform(Eina_Vector2 *out,
+                                             const Eina_Matrix3 *m,
+                                             const Eina_Vector2 *v)
+{
+   Eina_Vector2 tmp;
+
+   tmp.x = (m->xx * v->x) + (m->yx * v->y);
+   tmp.y = (m->xy * v->x) + (m->yy * v->y);
+
+   eina_vector2_copy(out, &tmp);
+}
 
 #endif