From f2e76e835645e8771a59404c27ef7546ba4cfb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexei=20Podtelezhnikov=20=28=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B5=D0=B9=20=D0=9F=D0=BE=D0=B4=D1=82=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=B6=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=29?= Date: Thu, 2 Nov 2023 22:08:04 -0400 Subject: [PATCH] [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 6343e902e..a77b57fd1 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 );