freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [raster] Handle Bézier stack locally.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [raster] Handle Bézier stack locally.
Date: Tue, 29 Jun 2021 03:27:30 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-06-28  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[raster] Handle Bézier stack locally.
    
    4
    +
    
    5
    +	* src/raster/ftraster.c (black_TWorker): Move `arcs' from here...
    
    6
    +	(Conic_To, Cubic_To): ... to here to tighten their scope.
    
    7
    +	(Bezier_Up, Bezier_Down): ... Take the current `arc' argument.
    
    8
    +
    
    1 9
     2021-06-28  Dominik Röttsches  <drott@chromium.org>
    
    2 10
     
    
    3 11
     	[sfnt] Improve paint limit checks
    

  • src/raster/ftraster.c
    ... ... @@ -483,8 +483,6 @@
    483 483
     
    
    484 484
         Int         numTurns;           /* number of Y-turns in outline        */
    
    485 485
     
    
    486
    -    TPoint*     arc;                /* current Bezier arc pointer          */
    
    487
    -
    
    488 486
         UShort      bWidth;             /* target bitmap width                 */
    
    489 487
         PByte       bOrigin;            /* target bitmap bottom-left origin    */
    
    490 488
         PByte       bLine;              /* target bitmap current line          */
    
    ... ... @@ -523,8 +521,6 @@
    523 521
                                         /* drop-out accurately when calling    */
    
    524 522
                                         /* Render_Glyph.                       */
    
    525 523
     
    
    526
    -    TPoint      arcs[3 * MaxBezier + 1]; /* The Bezier stack               */
    
    527
    -
    
    528 524
         black_TBand  band_stack[16];    /* band stack used for sub-banding     */
    
    529 525
                                         /* enough for signed short bands       */
    
    530 526
     
    
    ... ... @@ -1198,6 +1194,7 @@
    1198 1194
        */
    
    1199 1195
       static Bool
    
    1200 1196
       Bezier_Up( RAS_ARGS Int        degree,
    
    1197
    +                      TPoint*    arc,
    
    1201 1198
                           TSplitter  splitter,
    
    1202 1199
                           Long       miny,
    
    1203 1200
                           Long       maxy )
    
    ... ... @@ -1205,13 +1202,11 @@
    1205 1202
         Long   y1, y2, e, e2, e0;
    
    1206 1203
         Short  f1;
    
    1207 1204
     
    
    1208
    -    TPoint*  arc;
    
    1209 1205
         TPoint*  start_arc;
    
    1210 1206
     
    
    1211 1207
         PLong top;
    
    1212 1208
     
    
    1213 1209
     
    
    1214
    -    arc = ras.arc;
    
    1215 1210
         y1  = arc[degree].y;
    
    1216 1211
         y2  = arc[0].y;
    
    1217 1212
         top = ras.top;
    
    ... ... @@ -1303,7 +1298,6 @@
    1303 1298
     
    
    1304 1299
       Fin:
    
    1305 1300
         ras.top  = top;
    
    1306
    -    ras.arc -= degree;
    
    1307 1301
         return SUCCESS;
    
    1308 1302
       }
    
    1309 1303
     
    
    ... ... @@ -1335,11 +1329,11 @@
    1335 1329
        */
    
    1336 1330
       static Bool
    
    1337 1331
       Bezier_Down( RAS_ARGS Int        degree,
    
    1332
    +                        TPoint*    arc,
    
    1338 1333
                             TSplitter  splitter,
    
    1339 1334
                             Long       miny,
    
    1340 1335
                             Long       maxy )
    
    1341 1336
       {
    
    1342
    -    TPoint*  arc = ras.arc;
    
    1343 1337
         Bool     result, fresh;
    
    1344 1338
     
    
    1345 1339
     
    
    ... ... @@ -1351,7 +1345,7 @@
    1351 1345
     
    
    1352 1346
         fresh = ras.fresh;
    
    1353 1347
     
    
    1354
    -    result = Bezier_Up( RAS_VARS degree, splitter, -maxy, -miny );
    
    1348
    +    result = Bezier_Up( RAS_VARS degree, arc, splitter, -maxy, -miny );
    
    1355 1349
     
    
    1356 1350
         if ( fresh && !ras.fresh )
    
    1357 1351
           ras.cProfile->start = -ras.cProfile->start;
    
    ... ... @@ -1492,22 +1486,24 @@
    1492 1486
       {
    
    1493 1487
         Long     y1, y2, y3, x3, ymin, ymax;
    
    1494 1488
         TStates  state_bez;
    
    1489
    +    TPoint   arcs[2 * MaxBezier + 1]; /* The Bezier stack           */
    
    1490
    +    TPoint*  arc;                     /* current Bezier arc pointer */
    
    1495 1491
     
    
    1496 1492
     
    
    1497
    -    ras.arc      = ras.arcs;
    
    1498
    -    ras.arc[2].x = ras.lastX;
    
    1499
    -    ras.arc[2].y = ras.lastY;
    
    1500
    -    ras.arc[1].x = cx;
    
    1501
    -    ras.arc[1].y = cy;
    
    1502
    -    ras.arc[0].x = x;
    
    1503
    -    ras.arc[0].y = y;
    
    1493
    +    arc      = arcs;
    
    1494
    +    arc[2].x = ras.lastX;
    
    1495
    +    arc[2].y = ras.lastY;
    
    1496
    +    arc[1].x = cx;
    
    1497
    +    arc[1].y = cy;
    
    1498
    +    arc[0].x = x;
    
    1499
    +    arc[0].y = y;
    
    1504 1500
     
    
    1505 1501
         do
    
    1506 1502
         {
    
    1507
    -      y1 = ras.arc[2].y;
    
    1508
    -      y2 = ras.arc[1].y;
    
    1509
    -      y3 = ras.arc[0].y;
    
    1510
    -      x3 = ras.arc[0].x;
    
    1503
    +      y1 = arc[2].y;
    
    1504
    +      y2 = arc[1].y;
    
    1505
    +      y3 = arc[0].y;
    
    1506
    +      x3 = arc[0].x;
    
    1511 1507
     
    
    1512 1508
           /* first, categorize the Bezier arc */
    
    1513 1509
     
    
    ... ... @@ -1525,13 +1521,13 @@
    1525 1521
           if ( y2 < ymin || y2 > ymax )
    
    1526 1522
           {
    
    1527 1523
             /* this arc has no given direction, split it! */
    
    1528
    -        Split_Conic( ras.arc );
    
    1529
    -        ras.arc += 2;
    
    1524
    +        Split_Conic( arc );
    
    1525
    +        arc += 2;
    
    1530 1526
           }
    
    1531 1527
           else if ( y1 == y3 )
    
    1532 1528
           {
    
    1533 1529
             /* this arc is flat, ignore it and pop it from the Bezier stack */
    
    1534
    -        ras.arc -= 2;
    
    1530
    +        arc -= 2;
    
    1535 1531
           }
    
    1536 1532
           else
    
    1537 1533
           {
    
    ... ... @@ -1558,15 +1554,18 @@
    1558 1554
             /* now call the appropriate routine */
    
    1559 1555
             if ( state_bez == Ascending_State )
    
    1560 1556
             {
    
    1561
    -          if ( Bezier_Up( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
    
    1557
    +          if ( Bezier_Up( RAS_VARS 2, arc, Split_Conic,
    
    1558
    +                                   ras.minY, ras.maxY ) )
    
    1562 1559
                 goto Fail;
    
    1563 1560
             }
    
    1564 1561
             else
    
    1565
    -          if ( Bezier_Down( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
    
    1562
    +          if ( Bezier_Down( RAS_VARS 2, arc, Split_Conic,
    
    1563
    +                                     ras.minY, ras.maxY ) )
    
    1566 1564
                 goto Fail;
    
    1565
    +        arc -= 2;
    
    1567 1566
           }
    
    1568 1567
     
    
    1569
    -    } while ( ras.arc >= ras.arcs );
    
    1568
    +    } while ( arc >= arcs );
    
    1570 1569
     
    
    1571 1570
         ras.lastX = x3;
    
    1572 1571
         ras.lastY = y3;
    
    ... ... @@ -1621,25 +1620,27 @@
    1621 1620
       {
    
    1622 1621
         Long     y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
    
    1623 1622
         TStates  state_bez;
    
    1623
    +    TPoint   arcs[3 * MaxBezier + 1]; /* The Bezier stack           */
    
    1624
    +    TPoint*  arc;                     /* current Bezier arc pointer */
    
    1624 1625
     
    
    1625 1626
     
    
    1626
    -    ras.arc      = ras.arcs;
    
    1627
    -    ras.arc[3].x = ras.lastX;
    
    1628
    -    ras.arc[3].y = ras.lastY;
    
    1629
    -    ras.arc[2].x = cx1;
    
    1630
    -    ras.arc[2].y = cy1;
    
    1631
    -    ras.arc[1].x = cx2;
    
    1632
    -    ras.arc[1].y = cy2;
    
    1633
    -    ras.arc[0].x = x;
    
    1634
    -    ras.arc[0].y = y;
    
    1627
    +    arc      = arcs;
    
    1628
    +    arc[3].x = ras.lastX;
    
    1629
    +    arc[3].y = ras.lastY;
    
    1630
    +    arc[2].x = cx1;
    
    1631
    +    arc[2].y = cy1;
    
    1632
    +    arc[1].x = cx2;
    
    1633
    +    arc[1].y = cy2;
    
    1634
    +    arc[0].x = x;
    
    1635
    +    arc[0].y = y;
    
    1635 1636
     
    
    1636 1637
         do
    
    1637 1638
         {
    
    1638
    -      y1 = ras.arc[3].y;
    
    1639
    -      y2 = ras.arc[2].y;
    
    1640
    -      y3 = ras.arc[1].y;
    
    1641
    -      y4 = ras.arc[0].y;
    
    1642
    -      x4 = ras.arc[0].x;
    
    1639
    +      y1 = arc[3].y;
    
    1640
    +      y2 = arc[2].y;
    
    1641
    +      y3 = arc[1].y;
    
    1642
    +      y4 = arc[0].y;
    
    1643
    +      x4 = arc[0].x;
    
    1643 1644
     
    
    1644 1645
           /* first, categorize the Bezier arc */
    
    1645 1646
     
    
    ... ... @@ -1668,13 +1669,13 @@
    1668 1669
           if ( ymin2 < ymin1 || ymax2 > ymax1 )
    
    1669 1670
           {
    
    1670 1671
             /* this arc has no given direction, split it! */
    
    1671
    -        Split_Cubic( ras.arc );
    
    1672
    -        ras.arc += 3;
    
    1672
    +        Split_Cubic( arc );
    
    1673
    +        arc += 3;
    
    1673 1674
           }
    
    1674 1675
           else if ( y1 == y4 )
    
    1675 1676
           {
    
    1676 1677
             /* this arc is flat, ignore it and pop it from the Bezier stack */
    
    1677
    -        ras.arc -= 3;
    
    1678
    +        arc -= 3;
    
    1678 1679
           }
    
    1679 1680
           else
    
    1680 1681
           {
    
    ... ... @@ -1700,15 +1701,18 @@
    1700 1701
             /* compute intersections */
    
    1701 1702
             if ( state_bez == Ascending_State )
    
    1702 1703
             {
    
    1703
    -          if ( Bezier_Up( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
    
    1704
    +          if ( Bezier_Up( RAS_VARS 3, arc, Split_Cubic,
    
    1705
    +                                   ras.minY, ras.maxY ) )
    
    1704 1706
                 goto Fail;
    
    1705 1707
             }
    
    1706 1708
             else
    
    1707
    -          if ( Bezier_Down( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
    
    1709
    +          if ( Bezier_Down( RAS_VARS 3, arc, Split_Cubic,
    
    1710
    +                                     ras.minY, ras.maxY ) )
    
    1708 1711
                 goto Fail;
    
    1712
    +        arc -= 3;
    
    1709 1713
           }
    
    1710 1714
     
    
    1711
    -    } while ( ras.arc >= ras.arcs );
    
    1715
    +    } while ( arc >= arcs );
    
    1712 1716
     
    
    1713 1717
         ras.lastX = x4;
    
    1714 1718
         ras.lastY = y4;
    


  • reply via email to

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