freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] raster_2023 6001504ae 1/2: [raster] Remove the jitter except


From: Werner Lemberg
Subject: [freetype2] raster_2023 6001504ae 1/2: [raster] Remove the jitter exception.
Date: Thu, 2 Nov 2023 22:18:58 -0400 (EDT)

branch: raster_2023
commit 6001504aef3f8f7e5100ceadb20985c43181841d
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [raster] Remove the jitter exception.
    
    The jitter exception used to be applied when two neighboring pixels
    were barely inside the outline. One the left one was turned on then,
    which contradicts the OpenType specifications.  Intended to remove
    glitches, it caused disappearing lines and was softened by adding an
    exception to the exception (#54589).
    
    * src/raster/ftraster.c (Vertical_Sweep_Span): Drop the jitter exception.
---
 src/raster/ftraster.c | 37 ++++++-------------------------------
 1 file changed, 6 insertions(+), 31 deletions(-)

diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index e32f97014..5b9601375 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -448,7 +448,6 @@
     Int         precision_half;
     Int         precision_scale;
     Int         precision_step;
-    Int         precision_jitter;
 
     PLong       buff;               /* The profiles buffer                 */
     PLong       sizeBuff;           /* Render pool size                    */
@@ -549,27 +548,17 @@
      *
      *   256 / (1 << 12) = 0.0625 pixels.
      *
-     * `precision_jitter' is an epsilon threshold used in
-     * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier
-     * decomposition (after all, we are working with approximations only);
-     * it avoids switching on additional pixels which would cause artifacts
-     * otherwise.
-     *
-     * The value of `precision_jitter' has been determined heuristically.
-     *
      */
 
     if ( High )
     {
       ras.precision_bits   = 12;
       ras.precision_step   = 256;
-      ras.precision_jitter = 30;
     }
     else
     {
       ras.precision_bits   = 6;
       ras.precision_step   = 32;
-      ras.precision_jitter = 2;
     }
 
     ras.precision       = 1 << ras.precision_bits;
@@ -2139,9 +2128,7 @@
                                 PProfile    left,
                                 PProfile    right )
   {
-    Long  e1, e2;
-
-    Int  dropOutControl = left->flags & 7;
+    Int  e1, e2;
 
     FT_UNUSED( y );
     FT_UNUSED( left );
@@ -2153,20 +2140,8 @@
                 ras.precision_bits, (double)x1 / (double)ras.precision,
                 ras.precision_bits, (double)x2 / (double)ras.precision ));
 
-    /* Drop-out control */
-
-    e1 = CEILING( x1 );
-    e2 = FLOOR( x2 );
-
-    /* take care of the special case where both the left */
-    /* and right contour lie exactly on pixel centers    */
-    if ( dropOutControl != 2                             &&
-         x2 - x1 - ras.precision <= ras.precision_jitter &&
-         e1 != x1 && e2 != x2                            )
-      e2 = e1;
-
-    e1 = TRUNC( e1 );
-    e2 = TRUNC( e2 );
+    e1 = (Int)TRUNC( CEILING( x1 ) );
+    e2 = (Int)TRUNC( FLOOR( x2 ) );
 
     if ( e2 >= 0 && e1 < ras.bWidth )
     {
@@ -2180,10 +2155,10 @@
       if ( e2 >= ras.bWidth )
         e2 = ras.bWidth - 1;
 
-      FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
+      FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
 
-      c1 = (Int)( e1 >> 3 );
-      c2 = (Int)( e2 >> 3 );
+      c1 = e1 >> 3;
+      c2 = e2 >> 3;
 
       f1 =  0xFF >> ( e1 & 7 );
       f2 = ~0x7F >> ( e2 & 7 );



reply via email to

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