freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [raster] Simplify sweeping entry and ex


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [raster] Simplify sweeping entry and exit.
Date: Tue, 31 Oct 2023 02:47:25 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 4e2d1f04
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2023-10-30T22:46:32-04:00
    [raster] Simplify sweeping entry and exit.
    
    * src/raster/ftraster.c (Draw_Sweep): Use y-turns to set the range,
    correctly set the initial position, directly loop through y_turns,
    and remove a 5-gray remnant at exit.
    

1 changed file:

Changes:

  • src/raster/ftraster.c
    ... ... @@ -2604,67 +2604,46 @@
    2604 2604
       static Bool
    
    2605 2605
       Draw_Sweep( RAS_ARG )
    
    2606 2606
       {
    
    2607
    -    Int           min_Y, max_Y, top, bottom, dropouts;
    
    2607
    +    Int           min_Y, max_Y, dropouts;
    
    2608 2608
         Int           y, y_change, y_height;
    
    2609 2609
     
    
    2610 2610
         PProfile      P, Q, P_Left, P_Right;
    
    2611 2611
     
    
    2612 2612
         Long          x1, x2, xs, e1, e2;
    
    2613 2613
     
    
    2614
    -    TProfileList  waiting    = NULL;
    
    2614
    +    TProfileList  waiting    = ras.fProfile;
    
    2615 2615
         TProfileList  draw_left  = NULL;
    
    2616 2616
         TProfileList  draw_right = NULL;
    
    2617 2617
     
    
    2618 2618
     
    
    2619
    -    /* first, compute min and max Y */
    
    2619
    +    /* use y_turns to set the drawing range */
    
    2620 2620
     
    
    2621
    -    P     = ras.fProfile;
    
    2622
    -    max_Y = (Int)TRUNC( ras.minY );
    
    2623
    -    min_Y = (Int)TRUNC( ras.maxY );
    
    2624
    -
    
    2625
    -    while ( P )
    
    2626
    -    {
    
    2627
    -      Q = P->link;
    
    2628
    -
    
    2629
    -      bottom = P->start;
    
    2630
    -      top    = P->start + P->height - 1;
    
    2631
    -
    
    2632
    -      if ( min_Y > bottom )
    
    2633
    -        min_Y = bottom;
    
    2634
    -      if ( max_Y < top )
    
    2635
    -        max_Y = top;
    
    2636
    -
    
    2637
    -      P->X = 0;
    
    2638
    -      InsNew( &waiting, P );
    
    2639
    -
    
    2640
    -      P = Q;
    
    2641
    -    }
    
    2621
    +    min_Y = (Int)ras.maxBuff[0];
    
    2622
    +    max_Y = (Int)ras.sizeBuff[-1] - 1;
    
    2642 2623
     
    
    2643 2624
         /* now initialize the sweep */
    
    2644 2625
     
    
    2645 2626
         ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
    
    2646 2627
     
    
    2647
    -    /* then compute the distance of each profile from min_Y */
    
    2628
    +    /* set the activation countdowns and the initial positions */
    
    2648 2629
     
    
    2649 2630
         P = waiting;
    
    2650
    -
    
    2651 2631
         while ( P )
    
    2652 2632
         {
    
    2653 2633
           P->countL = P->start - min_Y;
    
    2634
    +      P->X      = P->x[P->offset];
    
    2635
    +
    
    2654 2636
           P = P->link;
    
    2655 2637
         }
    
    2656 2638
     
    
    2657
    -    /* let's go */
    
    2639
    +    /* let's go, iterating through y_turns */
    
    2658 2640
     
    
    2659 2641
         y        = min_Y;
    
    2660 2642
         y_height = 0;
    
    2661 2643
     
    
    2662
    -    if ( ras.sizeBuff[-ras.numTurns] == min_Y )
    
    2663
    -      ras.numTurns--;
    
    2664
    -
    
    2665
    -    while ( ras.numTurns > 0 )
    
    2644
    +    while ( ++ras.maxBuff < ras.sizeBuff )
    
    2666 2645
         {
    
    2667
    -      /* check waiting list for new activations */
    
    2646
    +      /* check waiting list for new profile activations */
    
    2668 2647
     
    
    2669 2648
           P = waiting;
    
    2670 2649
     
    
    ... ... @@ -2690,7 +2669,7 @@
    2690 2669
           Sort( &draw_left );
    
    2691 2670
           Sort( &draw_right );
    
    2692 2671
     
    
    2693
    -      y_change = (Int)ras.sizeBuff[-ras.numTurns--];
    
    2672
    +      y_change = (Int)*ras.maxBuff;
    
    2694 2673
           y_height = y_change - y;
    
    2695 2674
     
    
    2696 2675
           while ( y < y_change )
    
    ... ... @@ -2768,7 +2747,7 @@
    2768 2747
             }
    
    2769 2748
           }
    
    2770 2749
     
    
    2771
    -      /* now finalize the profiles that need it */
    
    2750
    +      /* remove exhausted profiles */
    
    2772 2751
     
    
    2773 2752
           P = draw_left;
    
    2774 2753
           while ( P )
    
    ... ... @@ -2789,13 +2768,6 @@
    2789 2768
           }
    
    2790 2769
         }
    
    2791 2770
     
    
    2792
    -    /* for gray-scaling, flush the bitmap scanline cache */
    
    2793
    -    while ( y <= max_Y )
    
    2794
    -    {
    
    2795
    -      ras.Proc_Sweep_Step( RAS_VAR );
    
    2796
    -      y++;
    
    2797
    -    }
    
    2798
    -
    
    2799 2771
         return SUCCESS;
    
    2800 2772
     
    
    2801 2773
       Scan_DropOuts:
    


  • reply via email to

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