freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [raster] Speed up Bézier arches with ex


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [raster] Speed up Bézier arches with extrema.
Date: Tue, 28 Nov 2023 03:51:58 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 8f255c89
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2023-11-27T22:44:36-05:00
    [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.
    

1 changed file:

Changes:

  • src/raster/ftraster.c
    ... ... @@ -1342,7 +1342,7 @@
    1342 1342
             ymax = y1;
    
    1343 1343
           }
    
    1344 1344
     
    
    1345
    -      if ( y2 < ymin || y2 > ymax )
    
    1345
    +      if ( y2 < FLOOR( ymin ) || y2 > CEILING( ymax ) )
    
    1346 1346
           {
    
    1347 1347
             /* this arc has no given direction, split it! */
    
    1348 1348
             Split_Conic( arc );
    
    ... ... @@ -1350,7 +1350,8 @@
    1350 1350
           }
    
    1351 1351
           else if ( y1 == y3 )
    
    1352 1352
           {
    
    1353
    -        /* this arc is flat, ignore it and pop it from the Bezier stack */
    
    1353
    +        /* this arc is flat, advance position */
    
    1354
    +        /* and pop it from the Bezier stack   */
    
    1354 1355
             arc -= 2;
    
    1355 1356
     
    
    1356 1357
             ras.lastX = x3;
    
    ... ... @@ -1488,7 +1489,7 @@
    1488 1489
             ymax2 = y2;
    
    1489 1490
           }
    
    1490 1491
     
    
    1491
    -      if ( ymin2 < ymin1 || ymax2 > ymax1 )
    
    1492
    +      if ( ymin2 < FLOOR( ymin1 ) || ymax2 > CEILING( ymax1 ) )
    
    1492 1493
           {
    
    1493 1494
             /* this arc has no given direction, split it! */
    
    1494 1495
             Split_Cubic( arc );
    
    ... ... @@ -1496,7 +1497,8 @@
    1496 1497
           }
    
    1497 1498
           else if ( y1 == y4 )
    
    1498 1499
           {
    
    1499
    -        /* this arc is flat, ignore it and pop it from the Bezier stack */
    
    1500
    +        /* this arc is flat, advance position */
    
    1501
    +        /* and pop it from the Bezier stack   */
    
    1500 1502
             arc -= 3;
    
    1501 1503
     
    
    1502 1504
             ras.lastX = x4;
    


  • reply via email to

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