Commit b070264521386666dd0cbbedec469c84b26489ba

Alexei Podtelezhnikov 2021-05-10T22:06:01

* src/smooth/ftgrays.c (gray_hline): Simplify even-odd computations. It is too bad the even-odd rule is not used much.

diff --git a/ChangeLog b/ChangeLog
index ead7ae2..a8542d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-10  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/smooth/ftgrays.c (gray_hline): Simplify even-odd computations.
+
+	It is too bad the even-odd rule is not used much.
+
 2021-05-07  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	[type1] Avoid MM memory zeroing.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index dc25669..94169a0 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1182,10 +1182,10 @@ typedef ptrdiff_t  FT_PtrDist;
     /* compute the line's coverage depending on the outline fill rule */
     if ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL )
     {
-      coverage &= 511;
+      if ( coverage & 256 )  /* odd bit */
+        coverage = ~coverage;
 
-      if ( coverage >= 256 )
-        coverage = 511 - coverage;
+      /* higher bits discarded below */
     }
     else  /* default non-zero winding rule */
     {