ecore: remove float comparison warning from Ecore_Animator code.
authorCedric BAIL <cedric@osg.samsung.com>
Tue, 20 Dec 2016 00:33:19 +0000 (16:33 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 20 Dec 2016 00:33:46 +0000 (16:33 -0800)
src/lib/ecore/ecore_anim.c

index c4197fa..a60c159 100644 (file)
@@ -196,7 +196,7 @@ _timer_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread)
              d = fmod(t0, ft);
              if (tick)
                {
-                  if (pframetime != ft)
+                  if (!EINA_FLT_CMP(pframetime, ft))
                     {
                        t = (ft - d) * 1000000000.0;
                        t_ft = ft * 1000000000.0;
@@ -661,7 +661,7 @@ _cubic_bezier_t_get(double a,
     for (int i = 0; i < LIMIT; i++)
       {
          current_slope = _cubic_bezier_slope_get(guess_t, x1, x2);
-         if (current_slope == 0.0) return guess_t;
+         if (EINA_FLT_CMP(current_slope, 0.0)) return guess_t;
          current_x = _cubic_bezier_calc(guess_t, x1, x2) - a;
          change = current_x / current_slope;
          guess_t -= change;
@@ -677,8 +677,10 @@ _pos_map_cubic_bezier(double pos,
                       double x2,
                       double y2)
 {
-    if (x1 == y1 && x2 == y2) return pos;
-    return _cubic_bezier_calc(_cubic_bezier_t_get(pos, x1, x2), y1, y2);
+   if (EINA_FLT_CMP(x1, y1) &&
+       EINA_FLT_CMP(x2, y2))
+     return pos;
+   return _cubic_bezier_calc(_cubic_bezier_t_get(pos, x1, x2), y1, y2);
 }
 
 #define DBL_TO(Fp) eina_f32p32_double_to(Fp)
@@ -817,7 +819,7 @@ ecore_animator_frametime_set(double frametime)
 {
    EINA_MAIN_LOOP_CHECK_RETURN;
    if (frametime < 0.0) frametime = 0.0;
-   if (animators_frametime == frametime) return ;
+   if (EINA_FLT_CMP(animators_frametime, frametime)) return ;
    animators_frametime = frametime;
    _end_tick();
    if (_have_animators()) _begin_tick();