freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 2 commits: [pshinter] Remove unnecessar


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 2 commits: [pshinter] Remove unnecessary check.
Date: Mon, 04 Oct 2021 02:49:28 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • src/pshinter/pshalgo.c
    ... ... @@ -1050,7 +1050,7 @@
    1050 1050
       }
    
    1051 1051
     
    
    1052 1052
     
    
    1053
    -  static int
    
    1053
    +  static PSH_Dir
    
    1054 1054
       psh_compute_dir( FT_Pos  dx,
    
    1055 1055
                        FT_Pos  dy )
    
    1056 1056
       {
    
    ... ... @@ -1234,12 +1234,12 @@
    1234 1234
             dxi = vec[n].x - vec[n_prev].x;
    
    1235 1235
             dyi = vec[n].y - vec[n_prev].y;
    
    1236 1236
     
    
    1237
    -        point->dir_in = (FT_Char)psh_compute_dir( dxi, dyi );
    
    1237
    +        point->dir_in = psh_compute_dir( dxi, dyi );
    
    1238 1238
     
    
    1239 1239
             dxo = vec[n_next].x - vec[n].x;
    
    1240 1240
             dyo = vec[n_next].y - vec[n].y;
    
    1241 1241
     
    
    1242
    -        point->dir_out = (FT_Char)psh_compute_dir( dxo, dyo );
    
    1242
    +        point->dir_out = psh_compute_dir( dxo, dyo );
    
    1243 1243
     
    
    1244 1244
             /* detect smooth points */
    
    1245 1245
             if ( point->flags & PSH_POINT_OFF )
    
    ... ... @@ -1404,16 +1404,13 @@
    1404 1404
       }
    
    1405 1405
     
    
    1406 1406
     
    
    1407
    -  /* major_dir is the direction for points on the bottom/left of the stem; */
    
    1408
    -  /* Points on the top/right of the stem will have a direction of          */
    
    1409
    -  /* -major_dir.                                                           */
    
    1410
    -
    
    1407
    +  /* the min and max are based on contour orientation and fill rule */
    
    1411 1408
       static void
    
    1412 1409
       psh_hint_table_find_strong_points( PSH_Hint_Table  table,
    
    1413 1410
                                          PSH_Point       point,
    
    1414 1411
                                          FT_UInt         count,
    
    1415 1412
                                          FT_Int          threshold,
    
    1416
    -                                     FT_Int          major_dir )
    
    1413
    +                                     PSH_Dir         major_dir )
    
    1417 1414
       {
    
    1418 1415
         PSH_Hint*  sort      = table->sort;
    
    1419 1416
         FT_UInt    num_hints = table->num_hints;
    
    ... ... @@ -1421,59 +1418,56 @@
    1421 1418
     
    
    1422 1419
         for ( ; count > 0; count--, point++ )
    
    1423 1420
         {
    
    1424
    -      FT_Int  point_dir = 0;
    
    1425
    -      FT_Pos  org_u     = point->org_u;
    
    1421
    +      PSH_Dir  point_dir = PSH_DIR_NONE;
    
    1422
    +      FT_Pos   org_u     = point->org_u;
    
    1426 1423
     
    
    1427 1424
     
    
    1428 1425
           if ( psh_point_is_strong( point ) )
    
    1429 1426
             continue;
    
    1430 1427
     
    
    1431
    -      if ( PSH_DIR_COMPARE( point->dir_in, major_dir ) )
    
    1428
    +      if ( point->dir_in & major_dir )
    
    1432 1429
             point_dir = point->dir_in;
    
    1433 1430
     
    
    1434
    -      else if ( PSH_DIR_COMPARE( point->dir_out, major_dir ) )
    
    1431
    +      else if ( point->dir_out & major_dir )
    
    1435 1432
             point_dir = point->dir_out;
    
    1436 1433
     
    
    1437
    -      if ( point_dir )
    
    1434
    +      if ( point_dir & ( PSH_DIR_DOWN | PSH_DIR_RIGHT ) )
    
    1438 1435
           {
    
    1439
    -        if ( point_dir == major_dir )
    
    1440
    -        {
    
    1441
    -          FT_UInt  nn;
    
    1436
    +        FT_UInt  nn;
    
    1442 1437
     
    
    1443 1438
     
    
    1444
    -          for ( nn = 0; nn < num_hints; nn++ )
    
    1445
    -          {
    
    1446
    -            PSH_Hint  hint = sort[nn];
    
    1447
    -            FT_Pos    d    = org_u - hint->org_pos;
    
    1439
    +        for ( nn = 0; nn < num_hints; nn++ )
    
    1440
    +        {
    
    1441
    +          PSH_Hint  hint = sort[nn];
    
    1442
    +          FT_Pos    d    = org_u - hint->org_pos;
    
    1448 1443
     
    
    1449 1444
     
    
    1450
    -            if ( d < threshold && -d < threshold )
    
    1451
    -            {
    
    1452
    -              psh_point_set_strong( point );
    
    1453
    -              point->flags2 |= PSH_POINT_EDGE_MIN;
    
    1454
    -              point->hint    = hint;
    
    1455
    -              break;
    
    1456
    -            }
    
    1445
    +          if ( d < threshold && -d < threshold )
    
    1446
    +          {
    
    1447
    +            psh_point_set_strong( point );
    
    1448
    +            point->flags2 |= PSH_POINT_EDGE_MIN;
    
    1449
    +            point->hint    = hint;
    
    1450
    +            break;
    
    1457 1451
               }
    
    1458 1452
             }
    
    1459
    -        else if ( point_dir == -major_dir )
    
    1460
    -        {
    
    1461
    -          FT_UInt  nn;
    
    1453
    +      }
    
    1454
    +      else if ( point_dir & ( PSH_DIR_UP | PSH_DIR_LEFT ) )
    
    1455
    +      {
    
    1456
    +        FT_UInt  nn;
    
    1462 1457
     
    
    1463 1458
     
    
    1464
    -          for ( nn = 0; nn < num_hints; nn++ )
    
    1465
    -          {
    
    1466
    -            PSH_Hint  hint = sort[nn];
    
    1467
    -            FT_Pos    d    = org_u - hint->org_pos - hint->org_len;
    
    1459
    +        for ( nn = 0; nn < num_hints; nn++ )
    
    1460
    +        {
    
    1461
    +          PSH_Hint  hint = sort[nn];
    
    1462
    +          FT_Pos    d    = org_u - hint->org_pos - hint->org_len;
    
    1468 1463
     
    
    1469 1464
     
    
    1470
    -            if ( d < threshold && -d < threshold )
    
    1471
    -            {
    
    1472
    -              psh_point_set_strong( point );
    
    1473
    -              point->flags2 |= PSH_POINT_EDGE_MAX;
    
    1474
    -              point->hint    = hint;
    
    1475
    -              break;
    
    1476
    -            }
    
    1465
    +          if ( d < threshold && -d < threshold )
    
    1466
    +          {
    
    1467
    +            psh_point_set_strong( point );
    
    1468
    +            point->flags2 |= PSH_POINT_EDGE_MAX;
    
    1469
    +            point->hint    = hint;
    
    1470
    +            break;
    
    1477 1471
               }
    
    1478 1472
             }
    
    1479 1473
           }
    
    ... ... @@ -1572,7 +1566,7 @@
    1572 1566
         PS_Mask         mask      = table->hint_masks->masks;
    
    1573 1567
         FT_UInt         num_masks = table->hint_masks->num_masks;
    
    1574 1568
         FT_UInt         first     = 0;
    
    1575
    -    FT_Int          major_dir = ( dimension == 0 ) ? PSH_DIR_VERTICAL
    
    1569
    +    PSH_Dir         major_dir = ( dimension == 0 ) ? PSH_DIR_VERTICAL
    
    1576 1570
                                                        : PSH_DIR_HORIZONTAL;
    
    1577 1571
         PSH_Dimension   dim       = &glyph->globals->dimension[dimension];
    
    1578 1572
         FT_Fixed        scale     = dim->scale_mult;
    
    ... ... @@ -1657,8 +1651,8 @@
    1657 1651
     
    
    1658 1652
     
    
    1659 1653
           /* check tangents */
    
    1660
    -      if ( !PSH_DIR_COMPARE( point->dir_in,  PSH_DIR_HORIZONTAL ) &&
    
    1661
    -           !PSH_DIR_COMPARE( point->dir_out, PSH_DIR_HORIZONTAL ) )
    
    1654
    +      if ( !( point->dir_in  & PSH_DIR_HORIZONTAL ) &&
    
    1655
    +           !( point->dir_out & PSH_DIR_HORIZONTAL ) )
    
    1662 1656
             continue;
    
    1663 1657
     
    
    1664 1658
           /* skip strong points */
    

  • src/pshinter/pshalgo.h
    ... ... @@ -93,21 +93,17 @@ FT_BEGIN_HEADER
    93 93
       typedef struct PSH_PointRec_*    PSH_Point;
    
    94 94
       typedef struct PSH_ContourRec_*  PSH_Contour;
    
    95 95
     
    
    96
    -  enum
    
    96
    +  typedef enum PSH_Dir_
    
    97 97
       {
    
    98
    -    PSH_DIR_NONE  =  4,
    
    99
    -    PSH_DIR_UP    = -1,
    
    100
    -    PSH_DIR_DOWN  =  1,
    
    101
    -    PSH_DIR_LEFT  = -2,
    
    102
    -    PSH_DIR_RIGHT =  2
    
    103
    -  };
    
    98
    +    PSH_DIR_NONE       = 0,
    
    99
    +    PSH_DIR_UP         = 1,
    
    100
    +    PSH_DIR_DOWN       = 2,
    
    101
    +    PSH_DIR_VERTICAL   = 1 | 2,
    
    102
    +    PSH_DIR_LEFT       = 4,
    
    103
    +    PSH_DIR_RIGHT      = 8,
    
    104
    +    PSH_DIR_HORIZONTAL = 4 | 8
    
    104 105
     
    
    105
    -#define PSH_DIR_HORIZONTAL  2
    
    106
    -#define PSH_DIR_VERTICAL    1
    
    107
    -
    
    108
    -#define PSH_DIR_COMPARE( d1, d2 )   ( (d1) == (d2) || (d1) == -(d2) )
    
    109
    -#define PSH_DIR_IS_HORIZONTAL( d )  PSH_DIR_COMPARE( d, PSH_DIR_HORIZONTAL )
    
    110
    -#define PSH_DIR_IS_VERTICAL( d )    PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )
    
    106
    +  } PSH_Dir;
    
    111 107
     
    
    112 108
     
    
    113 109
       /* the following bit-flags are computed once by the glyph */
    
    ... ... @@ -160,8 +156,8 @@ FT_BEGIN_HEADER
    160 156
         PSH_Contour  contour;
    
    161 157
         FT_UInt      flags;
    
    162 158
         FT_UInt      flags2;
    
    163
    -    FT_Char      dir_in;
    
    164
    -    FT_Char      dir_out;
    
    159
    +    PSH_Dir      dir_in;
    
    160
    +    PSH_Dir      dir_out;
    
    165 161
         PSH_Hint     hint;
    
    166 162
         FT_Pos       org_u;
    
    167 163
         FT_Pos       org_v;
    


  • reply via email to

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