freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 822acb0 2/3: * src/base/ftcalc.c (FT_CeilFix, FT_Floo


From: Werner LEMBERG
Subject: [freetype2] master 822acb0 2/3: * src/base/ftcalc.c (FT_CeilFix, FT_FloorFix): Normalize.
Date: Wed, 09 Sep 2015 06:04:56 +0000

branch: master
commit 822acb025291e9a767c6408c765d4066c009a1c9
Author: Wojciech Mamrak <address@hidden>
Commit: Werner Lemberg <address@hidden>

    * src/base/ftcalc.c (FT_CeilFix, FT_FloorFix): Normalize.
    
    This commit makes the functions behave as expected, this is,
    rounding towards plus or minus infinity.
---
 ChangeLog                   |    7 +++++++
 include/freetype/freetype.h |    7 ++++---
 src/base/ftcalc.c           |    6 ++----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b4c306c..4e226c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-09  Wojciech Mamrak  <address@hidden>
+
+       * src/base/ftcalc.c (FT_CeilFix, FT_FloorFix): Normalize.
+
+       This commit makes the functions behave as expected, this is,
+       rounding towards plus or minus infinity.
+
 2015-09-07  Alexei Podtelezhnikov  <address@hidden>
 
        * src/smooth/ftgrays.c (gray_render_line): Simplify clipping.
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index fb1254b..aafbdfd 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -3955,7 +3955,8 @@ FT_BEGIN_HEADER
   /*    a :: The number to be rounded.                                     */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    The result of `(a + 0x8000) & -0x10000'.                           */
+  /*    `a' rounded to nearest 16.16 fixed integer, halfway cases away     */
+  /*    from zero.                                                         */
   /*                                                                       */
   FT_EXPORT( FT_Fixed )
   FT_RoundFix( FT_Fixed  a );
@@ -3974,7 +3975,7 @@ FT_BEGIN_HEADER
   /*    a :: The number for which the ceiling function is to be computed.  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    The result of `(a + 0x10000 - 1) & -0x10000'.                      */
+  /*    `a' rounded towards plus infinity.                                 */
   /*                                                                       */
   FT_EXPORT( FT_Fixed )
   FT_CeilFix( FT_Fixed  a );
@@ -3993,7 +3994,7 @@ FT_BEGIN_HEADER
   /*    a :: The number for which the floor function is to be computed.    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    The result of `a & -0x10000'.                                      */
+  /*    `a' rounded towards minus infinity.                                */
   /*                                                                       */
   FT_EXPORT( FT_Fixed )
   FT_FloorFix( FT_Fixed  a );
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 01aead5..edb27fd 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -96,8 +96,7 @@
   FT_EXPORT_DEF( FT_Fixed )
   FT_CeilFix( FT_Fixed  a )
   {
-    return a >= 0 ?   ( a + 0xFFFFL ) & ~0xFFFFL
-                  : -((-a + 0xFFFFL ) & ~0xFFFFL );
+    return ( a + 0xFFFFL ) & ~0xFFFFL;
   }
 
 
@@ -106,8 +105,7 @@
   FT_EXPORT_DEF( FT_Fixed )
   FT_FloorFix( FT_Fixed  a )
   {
-    return a >= 0 ?   a & ~0xFFFFL
-                  : -((-a) & ~0xFFFFL );
+    return a & ~0xFFFFL;
   }
 
 #ifndef FT_MSB



reply via email to

[Prev in Thread] Current Thread [Next in Thread]