[Mesa-dev] [PATCH 16/28] Replace IROUND_POS with _mesa_roundevenf

Dylan Baker dylan at pnwbakers.com
Fri Nov 9 18:40:09 UTC 2018


Which has the same behavior.
---
 src/mesa/drivers/x11/xm_api.c  |  2 +-
 src/mesa/main/imports.h        | 10 ----------
 src/mesa/swrast/s_aaline.c     |  3 +--
 src/mesa/swrast/s_aatriangle.c |  3 +--
 4 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index e8405950656..6ff1269d07d 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -151,7 +151,7 @@ gamma_adjust( GLfloat gamma, GLint value, GLint max )
    }
    else {
       double x = (double) value / (double) max;
-      return IROUND_POS((GLfloat) max * pow(x, 1.0F/gamma));
+      return _mesa_roundevenf((GLfloat) max * pow(x, 1.0F/gamma));
    }
 }
 
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 59133643442..fbb7e59ca06 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -136,16 +136,6 @@ static inline GLint64 IROUND64(float f)
 }
 
 
-/**
- * Convert positive float to int by rounding to nearest integer.
- */
-static inline int IROUND_POS(float f)
-{
-   assert(f >= 0.0F);
-   return (int) (f + 0.5F);
-}
-
-
 /**********************************************************************
  * Functions
  */
diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c
index de5b42b9f6b..e86d0b5015c 100644
--- a/src/mesa/swrast/s_aaline.c
+++ b/src/mesa/swrast/s_aaline.c
@@ -25,7 +25,6 @@
 
 #include "c99_math.h"
 #include "main/glheader.h"
-#include "main/imports.h"
 #include "main/macros.h"
 #include "main/mtypes.h"
 #include "main/teximage.h"
@@ -181,7 +180,7 @@ solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4])
       return 0;
    else if (z > CHAN_MAX)
       return CHAN_MAX;
-   return (GLchan) IROUND_POS(z);
+   return (GLchan) _mesa_roundevenf(z);
 #endif
 }
 
diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c
index b5109870437..20d0a9d3043 100644
--- a/src/mesa/swrast/s_aatriangle.c
+++ b/src/mesa/swrast/s_aatriangle.c
@@ -31,7 +31,6 @@
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/macros.h"
-#include "main/imports.h"
 #include "main/state.h"
 #include "s_aatriangle.h"
 #include "s_context.h"
@@ -124,7 +123,7 @@ solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4])
       return 0;
    else if (z > CHAN_MAX)
       return CHAN_MAX;
-   return (GLchan) IROUND_POS(z);
+   return (GLchan) _mesa_roundevenf(z);
 #endif
 }
 
-- 
2.19.1



More information about the mesa-dev mailing list