freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master cb47331: [raster] Introduce SMART macro.


From: Alexei Podtelezhnikov
Subject: [freetype2] master cb47331: [raster] Introduce SMART macro.
Date: Tue, 8 Sep 2020 22:42:49 -0400 (EDT)

branch: master
commit cb4733136992265ba8b52c5f009864a0b7769949
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [raster] Introduce SMART macro.
    
    * src/raster/ftraster.c (SMART): New macro for smart dropout rounding.
    (Verstical_Sweep_Drop, Horizontal_Sweep_Drop): Use it.
---
 ChangeLog             |  7 +++++++
 src/raster/ftraster.c | 11 +++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a04a205..b34a71d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-09-08  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+       [raster] Introduce SMART macro.
+
+       * src/raster/ftraster.c (SMART): New macro for smart dropout rounding.
+       (Verstical_Sweep_Drop, Horizontal_Sweep_Drop): Use it.
+
 2020-09-03  Boris Dalstein  <dalboris@gmail.com>
 
        [build] Make CMake install basic version information.
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 7ef1719..14ff4d4 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -459,6 +459,9 @@
 #define IS_TOP_OVERSHOOT( x )    \
           (Bool)( x - FLOOR( x ) >= ras.precision_half )
 
+  /* smart dropout rounding */
+#define SMART( x1, x2 )  FLOOR( ( (x1) + (x2) - 1 ) / 2 + ras.precision_half )
+
 #if FT_RENDER_POOL_SIZE > 2048
 #define FT_MAX_BLACK_POOL  ( FT_RENDER_POOL_SIZE / sizeof ( Long ) )
 #else
@@ -2360,7 +2363,7 @@
           break;
 
         case 4: /* smart drop-outs including stubs */
-          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+          pxl = SMART( x1, x2 );
           break;
 
         case 1: /* simple drop-outs excluding stubs */
@@ -2409,7 +2412,7 @@
           if ( dropOutControl == 1 )
             pxl = e2;
           else
-            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+            pxl = SMART( x1, x2 );
           break;
 
         default: /* modes 2, 3, 6, 7 */
@@ -2580,7 +2583,7 @@
           break;
 
         case 4: /* smart drop-outs including stubs */
-          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+          pxl = SMART( x1, x2 );
           break;
 
         case 1: /* simple drop-outs excluding stubs */
@@ -2604,7 +2607,7 @@
           if ( dropOutControl == 1 )
             pxl = e2;
           else
-            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+            pxl = SMART( x1, x2 );
           break;
 
         default: /* modes 2, 3, 6, 7 */



reply via email to

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