freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 8f255c89e: [raster] Speed up Bézier arches with extr


From: Werner Lemberg
Subject: [freetype2] master 8f255c89e: [raster] Speed up Bézier arches with extrema.
Date: Mon, 27 Nov 2023 22:52:11 -0500 (EST)

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

    [raster] Speed up Bézier arches with extrema.
    
    While it is recommended to have an explicit point at each curve
    extrema, they might be missing or outline could be rotated. This
    leads to excessive bisections in raster to find them.  This change
    helps to decrease the number of bisections.  The scanline
    intersections remain monotonous, of course.
    
    * src/raster/ftraster.c (Conic_To, Cubic_To): Check that control
    points cross the scanlines to bisect.
---
 src/raster/ftraster.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 7d5e9e59e..043d2faf0 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -1342,7 +1342,7 @@
         ymax = y1;
       }
 
-      if ( y2 < ymin || y2 > ymax )
+      if ( y2 < FLOOR( ymin ) || y2 > CEILING( ymax ) )
       {
         /* this arc has no given direction, split it! */
         Split_Conic( arc );
@@ -1350,7 +1350,8 @@
       }
       else if ( y1 == y3 )
       {
-        /* this arc is flat, ignore it and pop it from the Bezier stack */
+        /* this arc is flat, advance position */
+        /* and pop it from the Bezier stack   */
         arc -= 2;
 
         ras.lastX = x3;
@@ -1488,7 +1489,7 @@
         ymax2 = y2;
       }
 
-      if ( ymin2 < ymin1 || ymax2 > ymax1 )
+      if ( ymin2 < FLOOR( ymin1 ) || ymax2 > CEILING( ymax1 ) )
       {
         /* this arc has no given direction, split it! */
         Split_Cubic( arc );
@@ -1496,7 +1497,8 @@
       }
       else if ( y1 == y4 )
       {
-        /* this arc is flat, ignore it and pop it from the Bezier stack */
+        /* this arc is flat, advance position */
+        /* and pop it from the Bezier stack   */
         arc -= 3;
 
         ras.lastX = x4;



reply via email to

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