freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master c372164 1/2: [raster] Tune SMART macro (#58352).


From: Alexei Podtelezhnikov
Subject: [freetype2] master c372164 1/2: [raster] Tune SMART macro (#58352).
Date: Sun, 13 Sep 2020 09:18:58 -0400 (EDT)

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

    [raster] Tune SMART macro (#58352).
    
    Windows seems to perform smart dropout control at 26.6 precision.
    To mimick Windows independent of increased precision, we need to tweak
    the macro so that some close calls break down rather than up.
    
    * src/raster/ftraster.c (SMART): Tweak the macro.
---
 ChangeLog             | 10 ++++++++++
 src/raster/ftraster.c |  5 +++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b34a71d..05033bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2020-09-08  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
+       [raster] Tune SMART macro (#58352).
+
+       Windows seems to perform smart dropout control at 26.6 precision.
+       To mimick Windows independent of increased precision, we need to tweak
+       the macro so that some close calls break down rather than up.
+
+       * src/raster/ftraster.c (SMART): Tweak the macro.
+
+2020-09-08  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
        [raster] Introduce SMART macro.
 
        * src/raster/ftraster.c (SMART): New macro for smart dropout rounding.
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 14ff4d4..71fac3f 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -459,8 +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 )
+  /* smart dropout rounding to find which pixel is closer to span ends;    */
+  /* to mimick Windows, symmetric cases break down indepenent of precision */
+#define SMART( p, q )  FLOOR( ( (p) + (q) + ras.precision * 63 / 64 ) >> 1 )
 
 #if FT_RENDER_POOL_SIZE > 2048
 #define FT_MAX_BLACK_POOL  ( FT_RENDER_POOL_SIZE / sizeof ( Long ) )



reply via email to

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