freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [raster] Keep only bottom y-turns.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [raster] Keep only bottom y-turns.
Date: Thu, 16 Nov 2023 04:44:19 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 050a3207
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2023-11-15T23:41:56-05:00
    [raster] Keep only bottom y-turns.
    
    This results in noticeable performance improvement.
    
    * src/raster/ftraster.c (Insert_Y_Turns): All bottom y-turns are still
    sorted and stored; only the maximum top y-turn is recorded now. The
    function is renamed.
    (End_Profile): Updated accordingly.
    (Convert_Glyph): Reserve space for the top value.
    

1 changed file:

Changes:

  • src/raster/ftraster.c
    ... ... @@ -116,8 +116,8 @@
    116 116
        *   generated until the end of the outline.
    
    117 117
        *
    
    118 118
        *   Note that, for all generated profiles, the function End_Profile()
    
    119
    -   *   is used to record their bottom-most scanline as well as the
    
    120
    -   *   scanline above its upmost boundary.  These positions are called
    
    119
    +   *   is used to record all their bottom-most scanlines as well as the
    
    120
    +   *   scanline above their upmost boundary.  These positions are called
    
    121 121
        *   `y-turns' because they (sort of) correspond to local extrema.
    
    122 122
        *   They are stored in a sorted list built from the top of the render
    
    123 123
        *   pool as a downwards stack:
    
    ... ... @@ -579,12 +579,17 @@
    579 579
        *   SUCCESS on success.  FAILURE in case of overflow.
    
    580 580
        */
    
    581 581
       static Bool
    
    582
    -  Insert_Y_Turn( RAS_ARGS Int  y )
    
    582
    +  Insert_Y_Turns( RAS_ARGS Int  y,
    
    583
    +                           Int  top )
    
    583 584
       {
    
    584 585
         Int    n       = ras.numTurns;
    
    585 586
         PLong  y_turns = ras.maxBuff;
    
    586 587
     
    
    587 588
     
    
    589
    +    /* update top value */
    
    590
    +    if ( n == 0 || top > y_turns[n] )
    
    591
    +      y_turns[n] = top;
    
    592
    +
    
    588 593
         /* look for first y value that is <= */
    
    589 594
         while ( n-- && y < y_turns[n] )
    
    590 595
           ;
    
    ... ... @@ -751,8 +756,7 @@
    751 756
             p->X      = p->x[h - 1];
    
    752 757
           }
    
    753 758
     
    
    754
    -      if ( Insert_Y_Turn( RAS_VARS bottom ) ||
    
    755
    -           Insert_Y_Turn( RAS_VARS top )    )
    
    759
    +      if ( Insert_Y_Turns( RAS_VARS bottom, top ) )
    
    756 760
             return FAILURE;
    
    757 761
     
    
    758 762
           if ( !ras.gProfile )
    
    ... ... @@ -1820,7 +1824,7 @@
    1820 1824
         ras.cProfile = NULL;
    
    1821 1825
     
    
    1822 1826
         ras.top      = ras.buff;
    
    1823
    -    ras.maxBuff  = ras.sizeBuff;
    
    1827
    +    ras.maxBuff  = ras.sizeBuff - 1;  /* top reserve */
    
    1824 1828
     
    
    1825 1829
         ras.numTurns  = 0;
    
    1826 1830
         ras.num_Profs = 0;
    


  • reply via email to

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