freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [cff, truetype] Rearrange variation ran


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [cff, truetype] Rearrange variation range checks.
Date: Tue, 21 May 2024 18:26:14 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 99be2b31
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-21T18:26:09+00:00
    [cff, truetype] Rearrange variation range checks.
    
    This should achieve quicker results for common cases.
    
    * src/cff/cffload.c (cff_blend_build_vector): Rearrange conditionals.
    * src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto.

2 changed files:

Changes:

  • src/cff/cffload.c
    ... ... @@ -1497,24 +1497,23 @@
    1497 1497
             CFF_AxisCoords*  axis = &varRegion->axisList[j];
    
    1498 1498
     
    
    1499 1499
     
    
    1500
    -        /* compute the scalar contribution of this axis; */
    
    1501
    -        /* ignore invalid ranges                         */
    
    1502
    -        if ( axis->startCoord > axis->peakCoord ||
    
    1503
    -             axis->peakCoord > axis->endCoord   )
    
    1500
    +        /* compute the scalar contribution of this axis */
    
    1501
    +        /* while running mandatory range checks         */
    
    1502
    +        if ( axis->peakCoord == NDV[j] ||
    
    1503
    +             axis->peakCoord == 0      )
    
    1504 1504
               continue;
    
    1505 1505
     
    
    1506 1506
             else if ( axis->startCoord < 0 &&
    
    1507
    -                  axis->endCoord > 0   &&
    
    1508
    -                  axis->peakCoord != 0 )
    
    1507
    +                  axis->endCoord   > 0 )
    
    1509 1508
               continue;
    
    1510 1509
     
    
    1511
    -        /* peak of 0 means ignore this axis */
    
    1512
    -        else if ( axis->peakCoord == 0 )
    
    1510
    +        else if ( axis->startCoord > axis->peakCoord ||
    
    1511
    +                  axis->peakCoord  > axis->endCoord  )
    
    1513 1512
               continue;
    
    1514 1513
     
    
    1515 1514
             /* ignore this region if coords are out of range */
    
    1516
    -        else if ( NDV[j] < axis->startCoord ||
    
    1517
    -                  NDV[j] > axis->endCoord   )
    
    1515
    +        else if ( NDV[j] <= axis->startCoord ||
    
    1516
    +                  NDV[j] >= axis->endCoord   )
    
    1518 1517
             {
    
    1519 1518
               blend->BV[master] = 0;
    
    1520 1519
               break;
    
    ... ... @@ -1525,8 +1524,7 @@
    1525 1524
               blend->BV[master] = FT_MulDiv( blend->BV[master],
    
    1526 1525
                                              NDV[j] - axis->startCoord,
    
    1527 1526
                                              axis->peakCoord - axis->startCoord );
    
    1528
    -
    
    1529
    -        else if ( NDV[j] > axis->peakCoord )
    
    1527
    +        else   /* NDV[j] > axis->peakCoord ) */
    
    1530 1528
               blend->BV[master] = FT_MulDiv( blend->BV[master],
    
    1531 1529
                                              axis->endCoord - NDV[j],
    
    1532 1530
                                              axis->endCoord - axis->peakCoord );
    

  • src/truetype/ttgxvar.c
    ... ... @@ -1077,24 +1077,23 @@
    1077 1077
             FT_Fixed  ncv = ttface->blend->normalizedcoords[j];
    
    1078 1078
     
    
    1079 1079
     
    
    1080
    -        /* compute the scalar contribution of this axis; */
    
    1081
    -        /* ignore invalid ranges                         */
    
    1082
    -        if ( axis->startCoord > axis->peakCoord ||
    
    1083
    -             axis->peakCoord > axis->endCoord   )
    
    1080
    +        /* compute the scalar contribution of this axis */
    
    1081
    +        /* while running mandatory range checks         */
    
    1082
    +        if ( axis->peakCoord == ncv ||
    
    1083
    +             axis->peakCoord == 0   )
    
    1084 1084
               continue;
    
    1085 1085
     
    
    1086 1086
             else if ( axis->startCoord < 0 &&
    
    1087
    -                  axis->endCoord > 0   &&
    
    1088
    -                  axis->peakCoord != 0 )
    
    1087
    +                  axis->endCoord   > 0 )
    
    1089 1088
               continue;
    
    1090 1089
     
    
    1091
    -        /* peak of 0 means ignore this axis */
    
    1092
    -        else if ( axis->peakCoord == 0 )
    
    1090
    +        else if ( axis->startCoord > axis->peakCoord ||
    
    1091
    +                  axis->peakCoord  > axis->endCoord  )
    
    1093 1092
               continue;
    
    1094 1093
     
    
    1095 1094
             /* ignore this region if coords are out of range */
    
    1096
    -        else if ( ncv < axis->startCoord ||
    
    1097
    -                  ncv > axis->endCoord   )
    
    1095
    +        else if ( ncv <= axis->startCoord ||
    
    1096
    +                  ncv >= axis->endCoord   )
    
    1098 1097
             {
    
    1099 1098
               scalar = 0;
    
    1100 1099
               break;
    
    ... ... @@ -1105,7 +1104,7 @@
    1105 1104
               scalar = FT_MulDiv( scalar,
    
    1106 1105
                                   ncv - axis->startCoord,
    
    1107 1106
                                   axis->peakCoord - axis->startCoord );
    
    1108
    -        else if ( ncv > axis->peakCoord )
    
    1107
    +        else   /* ncv > axis->peakCoord */
    
    1109 1108
               scalar = FT_MulDiv( scalar,
    
    1110 1109
                                   axis->endCoord - ncv,
    
    1111 1110
                                   axis->endCoord - axis->peakCoord );
    


  • reply via email to

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