summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-12-20 10:21:02 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-12-20 16:39:29 -0800
commit0d1c0773a084ae3a13ecac176e96c5f8b00b7ede (patch)
treeba62f945fc34621443c8be5665f5bded1226061b /src/static_libs
parentada014ec09176d9eb7c64eed9c3c68c135dd1e71 (diff)
triangulator: fix float comparison warning.
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/triangulator/triangulator_stroker.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/static_libs/triangulator/triangulator_stroker.c b/src/static_libs/triangulator/triangulator_stroker.c
index 18f7ead..436229b 100644
--- a/src/static_libs/triangulator/triangulator_stroker.c
+++ b/src/static_libs/triangulator/triangulator_stroker.c
@@ -1,4 +1,3 @@
1
2#include "triangulator_stroker.h" 1#include "triangulator_stroker.h"
3#include <math.h> 2#include <math.h>
4 3
@@ -31,9 +30,9 @@ normal_vector(float x1, float y1, float x2, float y2, float width,
31 float dx = x2 - x1; 30 float dx = x2 - x1;
32 float dy = y2 - y1; 31 float dy = y2 - y1;
33 32
34 if (dx == 0) 33 if (EINA_FLT_CMP(dx, 0))
35 pw = width / fabsf(dy); 34 pw = width / fabsf(dy);
36 else if (dy == 0) 35 else if (EINA_FLT_CMP(dy, 0))
37 pw = width / fabsf(dx); 36 pw = width / fabsf(dx);
38 else 37 else
39 pw = width / sqrtf(dx*dx + dy*dy); 38 pw = width / sqrtf(dx*dx + dy*dy);
@@ -397,7 +396,7 @@ static inline void
397_skip_duplicate_points(const double **pts, const double *end_pts) 396_skip_duplicate_points(const double **pts, const double *end_pts)
398{ 397{
399 while ((*pts + 2) < end_pts && (*pts)[0] == (*pts)[2] && 398 while ((*pts + 2) < end_pts && (*pts)[0] == (*pts)[2] &&
400 (*pts)[1] == (*pts)[3]) 399 EINA_FLT_CMP((*pts)[1], (*pts)[3]))
401 { 400 {
402 *pts += 2; 401 *pts += 2;
403 } 402 }
@@ -425,7 +424,7 @@ _path_info_get(const Efl_Gfx_Path_Command *cmds, const double *pts, Eina_Bool *i
425 *implicit_close = EINA_TRUE; 424 *implicit_close = EINA_TRUE;
426 // fall through 425 // fall through
427 case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO: 426 case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO:
428 if ((pts[0] == pts[i]) && (pts[1] == pts[i+1])) 427 if (EINA_FLT_CMP(pts[0], pts[i]) && EINA_FLT_CMP(pts[1], pts[i+1]))
429 *ends_at_start = EINA_TRUE; 428 *ends_at_start = EINA_TRUE;
430 return; 429 return;
431 default: 430 default:
@@ -433,8 +432,8 @@ _path_info_get(const Efl_Gfx_Path_Command *cmds, const double *pts, Eina_Bool *i
433 } 432 }
434 } 433 }
435 // this path is the last path with out implicit close. 434 // this path is the last path with out implicit close.
436 *ends_at_start = pts[0] == pts[i] && 435 *ends_at_start = EINA_FLT_CMP(pts[0], pts[i]) &&
437 pts[1] == pts[i+1]; 436 EINA_FLT_CMP(pts[1], pts[i+1]);
438} 437}
439 438
440void 439void
@@ -493,7 +492,7 @@ triangulator_stroker_process(Triangulator_Stroker *stroker,
493 break; 492 break;
494 } 493 }
495 case EFL_GFX_PATH_COMMAND_TYPE_LINE_TO: 494 case EFL_GFX_PATH_COMMAND_TYPE_LINE_TO:
496 if (stroker->cx != (float)pts[0] || stroker->cy != (float)pts[1]) 495 if (!EINA_FLT_CMP(stroker->cx, pts[0]) || !EINA_FLT_CMP(stroker->cy, (float)pts[1]))
497 { 496 {
498 if (previous_type != EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO) 497 if (previous_type != EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO)
499 add_join(stroker, pts[0], pts[1]); 498 add_join(stroker, pts[0], pts[1]);
@@ -503,11 +502,15 @@ triangulator_stroker_process(Triangulator_Stroker *stroker,
503 pts+=2; 502 pts+=2;
504 break; 503 break;
505 case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: 504 case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO:
506 if (stroker->cx != (float)pts[0] || stroker->cy != (float)pts[1] || 505 if (!EINA_FLT_CMP(stroker->cx, pts[0]) ||
507 (float)pts[0] != (float)pts[2] || (float)pts[1] != (float)pts[3] || 506 !EINA_FLT_CMP(stroker->cy, pts[1]) ||
508 (float)pts[2] != (float)pts[4] || (float)pts[3] != (float)pts[5]) 507 !EINA_FLT_CMP(pts[0], pts[2]) ||
508 !EINA_FLT_CMP(pts[1], pts[3]) ||
509 !EINA_FLT_CMP(pts[2], pts[4]) ||
510 !EINA_FLT_CMP(pts[3], pts[5]))
509 { 511 {
510 if (stroker->cx != (float)pts[0] || stroker->cy != (float)pts[1]) 512 if (!EINA_FLT_CMP(stroker->cx, pts[0]) ||
513 !EINA_FLT_CMP(stroker->cy, pts[1]))
511 { 514 {
512 if (previous_type != EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO) 515 if (previous_type != EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO)
513 add_join(stroker, pts[0], pts[1]); 516 add_join(stroker, pts[0], pts[1]);