freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] * src/raster/ftraster.c (Insert_Y_Turn)


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] * src/raster/ftraster.c (Insert_Y_Turn): Improve flow.
Date: Sun, 22 Oct 2023 12:20:37 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 09ae6eb6
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2023-10-22T08:13:35-04:00
    * src/raster/ftraster.c (Insert_Y_Turn): Improve flow.
    

1 changed file:

Changes:

  • src/raster/ftraster.c
    ... ... @@ -609,19 +609,24 @@
    609 609
       static Bool
    
    610 610
       Insert_Y_Turn( RAS_ARGS Int  y )
    
    611 611
       {
    
    612
    -    PLong  y_turns;
    
    613
    -    Int    n;
    
    612
    +    Int    n       = ras.numTurns;
    
    613
    +    PLong  y_turns = ras.maxBuff;
    
    614 614
     
    
    615 615
     
    
    616
    -    n       = ras.numTurns - 1;
    
    617
    -    y_turns = ras.sizeBuff - ras.numTurns;
    
    618
    -
    
    619 616
         /* look for first y value that is <= */
    
    620
    -    while ( n >= 0 && y < y_turns[n] )
    
    621
    -      n--;
    
    617
    +    while ( n-- && y < y_turns[n] )
    
    618
    +      ;
    
    622 619
     
    
    623 620
         /* if it is <, simply insert it, ignore if == */
    
    624
    -    if ( n >= 0 && y > y_turns[n] )
    
    621
    +    if ( n < 0 || y > y_turns[n] )
    
    622
    +    {
    
    623
    +      ras.maxBuff--;
    
    624
    +      if ( ras.maxBuff <= ras.top )
    
    625
    +      {
    
    626
    +        ras.error = FT_THROW( Raster_Overflow );
    
    627
    +        return FAILURE;
    
    628
    +      }
    
    629
    +
    
    625 630
           do
    
    626 631
           {
    
    627 632
             Int  y2 = (Int)y_turns[n];
    
    ... ... @@ -629,18 +634,9 @@
    629 634
     
    
    630 635
             y_turns[n] = y;
    
    631 636
             y = y2;
    
    632
    -      } while ( --n >= 0 );
    
    637
    +      } while ( n-- >= 0 );
    
    633 638
     
    
    634
    -    if ( n < 0 )
    
    635
    -    {
    
    636
    -      ras.maxBuff--;
    
    637
    -      if ( ras.maxBuff <= ras.top )
    
    638
    -      {
    
    639
    -        ras.error = FT_THROW( Raster_Overflow );
    
    640
    -        return FAILURE;
    
    641
    -      }
    
    642 639
           ras.numTurns++;
    
    643
    -      ras.sizeBuff[-ras.numTurns] = y;
    
    644 640
         }
    
    645 641
     
    
    646 642
         return SUCCESS;
    


  • reply via email to

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