freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [raster] Revise overshoot setting.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [raster] Revise overshoot setting.
Date: Tue, 14 Nov 2023 15:54:55 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • d1b3ef77
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2023-11-14T15:54:52+00:00
    [raster] Revise overshoot setting.
    
    * src/raster/ftraster.c (New_Profile, End_Profile): Deal with overshoots
    locally.
    (Line_To, Conic_To, Cubic_To): Update callers.

1 changed file:

Changes:

  • src/raster/ftraster.c
    ... ... @@ -634,8 +634,7 @@
    634 634
        *  profile.
    
    635 635
        */
    
    636 636
       static Bool
    
    637
    -  New_Profile( RAS_ARGS TStates  aState,
    
    638
    -                        Bool     overshoot )
    
    637
    +  New_Profile( RAS_ARGS TStates  aState )
    
    639 638
       {
    
    640 639
         Long  e;
    
    641 640
     
    
    ... ... @@ -661,14 +660,14 @@
    661 660
         {
    
    662 661
         case Ascending_State:
    
    663 662
           ras.cProfile->flags |= Flow_Up;
    
    664
    -      if ( overshoot )
    
    663
    +      if ( IS_BOTTOM_OVERSHOOT( ras.lastY ) )
    
    665 664
             ras.cProfile->flags |= Overshoot_Bottom;
    
    666 665
     
    
    667 666
           e = CEILING( ras.lastY );
    
    668 667
           break;
    
    669 668
     
    
    670 669
         case Descending_State:
    
    671
    -      if ( overshoot )
    
    670
    +      if ( IS_TOP_OVERSHOOT( ras.lastY ) )
    
    672 671
             ras.cProfile->flags |= Overshoot_Top;
    
    673 672
     
    
    674 673
           e = FLOOR( ras.lastY );
    
    ... ... @@ -716,7 +715,7 @@
    716 715
        *   SUCCESS on success.  FAILURE in case of overflow or incoherency.
    
    717 716
        */
    
    718 717
       static Bool
    
    719
    -  End_Profile( RAS_ARGS Bool  overshoot )
    
    718
    +  End_Profile( RAS_ARG )
    
    720 719
       {
    
    721 720
         PProfile  p = ras.cProfile;
    
    722 721
         Int       h = (Int)( ras.top - p->x );
    
    ... ... @@ -735,11 +734,14 @@
    735 734
           FT_TRACE7(( "  ending profile %p, start = %2d, height = %+3d\n",
    
    736 735
                       (void *)p, p->start, p->flags & Flow_Up ? h : -h ));
    
    737 736
     
    
    738
    -      if ( overshoot )
    
    737
    +      if ( p->flags & Flow_Up )
    
    739 738
           {
    
    740
    -        if ( p->flags & Flow_Up )
    
    739
    +        if ( IS_TOP_OVERSHOOT( ras.lastY ) )
    
    741 740
               p->flags |= Overshoot_Top;
    
    742
    -        else
    
    741
    +      }
    
    742
    +      else
    
    743
    +      {
    
    744
    +        if ( IS_BOTTOM_OVERSHOOT( ras.lastY ) )
    
    743 745
               p->flags |= Overshoot_Bottom;
    
    744 746
           }
    
    745 747
     
    
    ... ... @@ -1243,25 +1245,21 @@
    1243 1245
         case Unknown_State:
    
    1244 1246
           if ( y > ras.lastY )
    
    1245 1247
           {
    
    1246
    -        if ( New_Profile( RAS_VARS Ascending_State,
    
    1247
    -                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
    
    1248
    +        if ( New_Profile( RAS_VARS Ascending_State ) )
    
    1248 1249
               return FAILURE;
    
    1249 1250
           }
    
    1250
    -      else
    
    1251
    +      else if ( y < ras.lastY )
    
    1251 1252
           {
    
    1252
    -        if ( y < ras.lastY )
    
    1253
    -          if ( New_Profile( RAS_VARS Descending_State,
    
    1254
    -                                     IS_TOP_OVERSHOOT( ras.lastY ) ) )
    
    1255
    -            return FAILURE;
    
    1253
    +        if ( New_Profile( RAS_VARS Descending_State ) )
    
    1254
    +          return FAILURE;
    
    1256 1255
           }
    
    1257 1256
           break;
    
    1258 1257
     
    
    1259 1258
         case Ascending_State:
    
    1260 1259
           if ( y < ras.lastY )
    
    1261 1260
           {
    
    1262
    -        if ( End_Profile( RAS_VARS IS_TOP_OVERSHOOT( ras.lastY ) ) ||
    
    1263
    -             New_Profile( RAS_VARS Descending_State,
    
    1264
    -                                   IS_TOP_OVERSHOOT( ras.lastY ) ) )
    
    1261
    +        if ( End_Profile( RAS_VAR )                   ||
    
    1262
    +             New_Profile( RAS_VARS Descending_State ) )
    
    1265 1263
               return FAILURE;
    
    1266 1264
           }
    
    1267 1265
           break;
    
    ... ... @@ -1269,9 +1267,8 @@
    1269 1267
         case Descending_State:
    
    1270 1268
           if ( y > ras.lastY )
    
    1271 1269
           {
    
    1272
    -        if ( End_Profile( RAS_VARS IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ||
    
    1273
    -             New_Profile( RAS_VARS Ascending_State,
    
    1274
    -                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
    
    1270
    +        if ( End_Profile( RAS_VAR )                  ||
    
    1271
    +             New_Profile( RAS_VARS Ascending_State ) )
    
    1275 1272
               return FAILURE;
    
    1276 1273
           }
    
    1277 1274
           break;
    
    ... ... @@ -1395,18 +1392,13 @@
    1395 1392
             state_bez = y1 < y3 ? Ascending_State : Descending_State;
    
    1396 1393
             if ( ras.state != state_bez )
    
    1397 1394
             {
    
    1398
    -          Bool  o = ( state_bez == Ascending_State )
    
    1399
    -                      ? IS_BOTTOM_OVERSHOOT( y1 )
    
    1400
    -                      : IS_TOP_OVERSHOOT( y1 );
    
    1401
    -
    
    1402
    -
    
    1403 1395
               /* finalize current profile if any */
    
    1404 1396
               if ( ras.state != Unknown_State &&
    
    1405
    -               End_Profile( RAS_VARS o )  )
    
    1397
    +               End_Profile( RAS_VAR )     )
    
    1406 1398
                 goto Fail;
    
    1407 1399
     
    
    1408 1400
               /* create a new profile */
    
    1409
    -          if ( New_Profile( RAS_VARS state_bez, o ) )
    
    1401
    +          if ( New_Profile( RAS_VARS state_bez ) )
    
    1410 1402
                 goto Fail;
    
    1411 1403
             }
    
    1412 1404
     
    
    ... ... @@ -1541,22 +1533,17 @@
    1541 1533
           }
    
    1542 1534
           else
    
    1543 1535
           {
    
    1544
    -        state_bez = ( y1 <= y4 ) ? Ascending_State : Descending_State;
    
    1536
    +        state_bez = y1 < y4 ? Ascending_State : Descending_State;
    
    1545 1537
     
    
    1546 1538
             /* detect a change of direction */
    
    1547 1539
             if ( ras.state != state_bez )
    
    1548 1540
             {
    
    1549
    -          Bool  o = ( state_bez == Ascending_State )
    
    1550
    -                      ? IS_BOTTOM_OVERSHOOT( y1 )
    
    1551
    -                      : IS_TOP_OVERSHOOT( y1 );
    
    1552
    -
    
    1553
    -
    
    1554 1541
               /* finalize current profile if any */
    
    1555 1542
               if ( ras.state != Unknown_State &&
    
    1556
    -               End_Profile( RAS_VARS o )  )
    
    1543
    +               End_Profile( RAS_VAR )     )
    
    1557 1544
                 goto Fail;
    
    1558 1545
     
    
    1559
    -          if ( New_Profile( RAS_VARS state_bez, o ) )
    
    1546
    +          if ( New_Profile( RAS_VARS state_bez ) )
    
    1560 1547
                 goto Fail;
    
    1561 1548
             }
    
    1562 1549
     
    
    ... ... @@ -1865,9 +1852,6 @@
    1865 1852
         last = -1;
    
    1866 1853
         for ( i = 0; i < ras.outline.n_contours; i++ )
    
    1867 1854
         {
    
    1868
    -      Bool      o;
    
    1869
    -
    
    1870
    -
    
    1871 1855
           ras.state    = Unknown_State;
    
    1872 1856
           ras.gProfile = NULL;
    
    1873 1857
     
    
    ... ... @@ -1890,10 +1874,7 @@
    1890 1874
                    ( ras.cProfile->flags & Flow_Up ) )
    
    1891 1875
               ras.top--;
    
    1892 1876
     
    
    1893
    -      o = ras.cProfile->flags & Flow_Up ? IS_TOP_OVERSHOOT( ras.lastY )
    
    1894
    -                                        : IS_BOTTOM_OVERSHOOT( ras.lastY );
    
    1895
    -
    
    1896
    -      if ( End_Profile( RAS_VARS o ) )
    
    1877
    +      if ( End_Profile( RAS_VAR ) )
    
    1897 1878
             return FAILURE;
    
    1898 1879
     
    
    1899 1880
           if ( !ras.fProfile )
    


  • reply via email to

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