summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-12-19 12:10:15 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-12-19 16:33:46 -0800
commit1f6c4b13708f133295869c5a191373538b79baae (patch)
treed8e8579361e2cb75d5343cd947d68b23f1ad305e /src
parent4489e7520e96b68d98c9210dd871a794a15ce8ea (diff)
eina: fix double comparison in eina bezier.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_bezier.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/eina/eina_bezier.c b/src/lib/eina/eina_bezier.c
index 649455172c..c6bcd3c04f 100644
--- a/src/lib/eina/eina_bezier.c
+++ b/src/lib/eina/eina_bezier.c
@@ -15,13 +15,12 @@
15 * License along with this library; 15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>. 16 * if not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18#include "eina_private.h"
19#include "eina_bezier.h"
20
21#include <math.h> 18#include <math.h>
22#include <float.h> 19#include <float.h>
23 20
24#define FLOAT_CMP(a, b) (fabs(a - b) <= 0.01/* DBL_MIN */) 21#include "eina_private.h"
22#include "eina_bezier.h"
23#include "eina_util.h"
25 24
26static void 25static void
27_eina_bezier_1st_derivative(const Eina_Bezier *bz, 26_eina_bezier_1st_derivative(const Eina_Bezier *bz,
@@ -94,7 +93,7 @@ _eina_bezier_length_helper(const Eina_Bezier *b,
94 93
95 chord = _line_length(b->start.x, b->start.y, b->end.x, b->end.y); 94 chord = _line_length(b->start.x, b->start.y, b->end.x, b->end.y);
96 95
97 if (!FLOAT_CMP(len, chord)) { 96 if (!EINA_DBL_CMP(len, chord)) {
98 _eina_bezier_split(b, &left, &right); /* split in two */ 97 _eina_bezier_split(b, &left, &right); /* split in two */
99 _eina_bezier_length_helper(&left, length); /* try left side */ 98 _eina_bezier_length_helper(&left, length); /* try left side */
100 _eina_bezier_length_helper(&right, length); /* try right side */ 99 _eina_bezier_length_helper(&right, length); /* try right side */
@@ -229,7 +228,7 @@ eina_bezier_t_at(const Eina_Bezier *b, double l)
229 double biggest = 1.0; 228 double biggest = 1.0;
230 double t = 1.0; 229 double t = 1.0;
231 230
232 if (l > len || (FLOAT_CMP(len, l))) 231 if (l > len || (EINA_DBL_CMP(len, l)))
233 return t; 232 return t;
234 233
235 t *= 0.5; 234 t *= 0.5;
@@ -243,7 +242,7 @@ eina_bezier_t_at(const Eina_Bezier *b, double l)
243 _eina_bezier_split_left(&right, t, &left); 242 _eina_bezier_split_left(&right, t, &left);
244 ll = eina_bezier_length_get(&left); 243 ll = eina_bezier_length_get(&left);
245 244
246 if (FLOAT_CMP(ll, l)) 245 if (EINA_DBL_CMP(ll, l))
247 break; 246 break;
248 247
249 if (ll < l) 248 if (ll < l)
@@ -320,7 +319,8 @@ eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *resul
320 Eina_Bezier bezier; 319 Eina_Bezier bezier;
321 double t; 320 double t;
322 321
323 if (t0 == 0 && t1 == 1) 322 if (EINA_DBL_CMP(t0, 0.0) &&
323 EINA_DBL_CMP(t1, 1.0))
324 { 324 {
325 *result = *b; 325 *result = *b;
326 return; 326 return;