... |
... |
@@ -340,14 +340,13 @@ |
340
|
340
|
/* during drop-out control */
|
341
|
341
|
Int offset; /* bottom or currently scanned array index */
|
342
|
342
|
Int height; /* profile's height in scanlines */
|
343
|
|
- Int start; /* profile's starting scanline */
|
|
343
|
+ Int start; /* profile's starting scanline, also use */
|
|
344
|
+ /* as activation counter */
|
344
|
345
|
UShort flags; /* Bit 0-2: drop-out mode */
|
345
|
346
|
/* Bit 3: profile orientation (up/down) */
|
346
|
347
|
/* Bit 4: is top profile? */
|
347
|
348
|
/* Bit 5: is bottom profile? */
|
348
|
349
|
|
349
|
|
- Int countL; /* number of lines to step before this */
|
350
|
|
- /* profile becomes drawable */
|
351
|
350
|
FT_F26Dot6 X; /* current coordinate during sweep */
|
352
|
351
|
Long x[1]; /* actually variable array of scanline */
|
353
|
352
|
/* intersections with `height` elements */
|
... |
... |
@@ -2019,59 +2018,32 @@ |
2019
|
2018
|
|
2020
|
2019
|
/**************************************************************************
|
2021
|
2020
|
*
|
2022
|
|
- * DelOld
|
|
2021
|
+ * Increment
|
2023
|
2022
|
*
|
2024
|
|
- * Removes an old profile from a linked list.
|
|
2023
|
+ * Advances all profile in the list to the next scanline. It also
|
|
2024
|
+ * sorts the trace list in the unlikely case of profile crossing.
|
|
2025
|
+ * In 95%, the list is already sorted. We need an algorithm which
|
|
2026
|
+ * is fast in this case. Bubble sort is enough and simple.
|
2025
|
2027
|
*/
|
2026
|
2028
|
static void
|
2027
|
|
- DelOld( PProfileList list,
|
2028
|
|
- const PProfile profile )
|
2029
|
|
- {
|
2030
|
|
- PProfile *old, current;
|
2031
|
|
-
|
2032
|
|
-
|
2033
|
|
- old = list;
|
2034
|
|
- current = *old;
|
2035
|
|
-
|
2036
|
|
- while ( current )
|
2037
|
|
- {
|
2038
|
|
- if ( current == profile )
|
2039
|
|
- {
|
2040
|
|
- *old = current->link;
|
2041
|
|
- return;
|
2042
|
|
- }
|
2043
|
|
-
|
2044
|
|
- old = ¤t->link;
|
2045
|
|
- current = *old;
|
2046
|
|
- }
|
2047
|
|
-
|
2048
|
|
- /* we should never get there, unless the profile was not part of */
|
2049
|
|
- /* the list. */
|
2050
|
|
- }
|
2051
|
|
-
|
2052
|
|
-
|
2053
|
|
- /**************************************************************************
|
2054
|
|
- *
|
2055
|
|
- * Sort
|
2056
|
|
- *
|
2057
|
|
- * Sorts a trace list. In 95%, the list is already sorted. We need
|
2058
|
|
- * an algorithm which is fast in this case. Bubble sort is enough
|
2059
|
|
- * and simple.
|
2060
|
|
- */
|
2061
|
|
- static void
|
2062
|
|
- Sort( PProfileList list )
|
|
2029
|
+ Increment( PProfileList list )
|
2063
|
2030
|
{
|
2064
|
2031
|
PProfile *old, current, next;
|
2065
|
2032
|
|
2066
|
2033
|
|
2067
|
|
- /* First, set the new X coordinate of each profile */
|
2068
|
|
- current = *list;
|
2069
|
|
- while ( current )
|
|
2034
|
+ /* First, set the new X coordinates and remove exhausted profiles */
|
|
2035
|
+ old = list;
|
|
2036
|
+ while ( *old )
|
2070
|
2037
|
{
|
2071
|
|
- current->X = current->x[current->offset];
|
2072
|
|
- current->offset += ( current->flags & Flow_Up ) ? 1 : -1;
|
2073
|
|
- current->height--;
|
2074
|
|
- current = current->link;
|
|
2038
|
+ current = *old;
|
|
2039
|
+ if ( --current->height )
|
|
2040
|
+ {
|
|
2041
|
+ current->offset += ( current->flags & Flow_Up ) ? 1 : -1;
|
|
2042
|
+ current->X = current->x[current->offset];
|
|
2043
|
+ old = ¤t->link;
|
|
2044
|
+ }
|
|
2045
|
+ else
|
|
2046
|
+ *old = current->link; /* remove */
|
2075
|
2047
|
}
|
2076
|
2048
|
|
2077
|
2049
|
/* Then sort them */
|
... |
... |
@@ -2203,6 +2175,8 @@ |
2203
|
2175
|
Long e1, e2, pxl;
|
2204
|
2176
|
Int c1, f1;
|
2205
|
2177
|
|
|
2178
|
+ FT_UNUSED( y );
|
|
2179
|
+
|
2206
|
2180
|
|
2207
|
2181
|
FT_TRACE7(( " y=%d x=[% .*f;% .*f]",
|
2208
|
2182
|
y,
|
... |
... |
@@ -2284,14 +2258,14 @@ |
2284
|
2258
|
|
2285
|
2259
|
/* upper stub test */
|
2286
|
2260
|
if ( left->next == right &&
|
2287
|
|
- left->height <= 0 &&
|
|
2261
|
+ left->height == 1 &&
|
2288
|
2262
|
!( left->flags & Overshoot_Top &&
|
2289
|
2263
|
x2 - x1 >= ras.precision_half ) )
|
2290
|
2264
|
goto Exit;
|
2291
|
2265
|
|
2292
|
2266
|
/* lower stub test */
|
2293
|
2267
|
if ( right->next == left &&
|
2294
|
|
- left->start == y &&
|
|
2268
|
+ left->offset == 0 &&
|
2295
|
2269
|
!( left->flags & Overshoot_Bottom &&
|
2296
|
2270
|
x2 - x1 >= ras.precision_half ) )
|
2297
|
2271
|
goto Exit;
|
... |
... |
@@ -2502,14 +2476,14 @@ |
2502
|
2476
|
|
2503
|
2477
|
/* rightmost stub test */
|
2504
|
2478
|
if ( left->next == right &&
|
2505
|
|
- left->height <= 0 &&
|
|
2479
|
+ left->height == 1 &&
|
2506
|
2480
|
!( left->flags & Overshoot_Top &&
|
2507
|
2481
|
x2 - x1 >= ras.precision_half ) )
|
2508
|
2482
|
goto Exit;
|
2509
|
2483
|
|
2510
|
2484
|
/* leftmost stub test */
|
2511
|
2485
|
if ( right->next == left &&
|
2512
|
|
- left->start == y &&
|
|
2486
|
+ left->offset == 0 &&
|
2513
|
2487
|
!( left->flags & Overshoot_Bottom &&
|
2514
|
2488
|
x2 - x1 >= ras.precision_half ) )
|
2515
|
2489
|
goto Exit;
|
... |
... |
@@ -2589,7 +2563,7 @@ |
2589
|
2563
|
Int min_Y, max_Y, dropouts;
|
2590
|
2564
|
Int y, y_change, y_height;
|
2591
|
2565
|
|
2592
|
|
- PProfile P, Q, P_Left, P_Right;
|
|
2566
|
+ PProfile *Q, P, P_Left, P_Right;
|
2593
|
2567
|
|
2594
|
2568
|
TProfileList waiting = ras.fProfile;
|
2595
|
2569
|
TProfileList draw_left = NULL;
|
... |
... |
@@ -2610,7 +2584,7 @@ |
2610
|
2584
|
P = waiting;
|
2611
|
2585
|
while ( P )
|
2612
|
2586
|
{
|
2613
|
|
- P->countL = P->start - min_Y;
|
|
2587
|
+ P->start -= min_Y;
|
2614
|
2588
|
P->X = P->x[P->offset];
|
2615
|
2589
|
|
2616
|
2590
|
P = P->link;
|
... |
... |
@@ -2625,34 +2599,28 @@ |
2625
|
2599
|
{
|
2626
|
2600
|
/* check waiting list for new profile activations */
|
2627
|
2601
|
|
2628
|
|
- P = waiting;
|
2629
|
|
-
|
2630
|
|
- while ( P )
|
|
2602
|
+ Q = &waiting;
|
|
2603
|
+ while ( *Q )
|
2631
|
2604
|
{
|
2632
|
|
- Q = P->link;
|
2633
|
|
- P->countL -= y_height;
|
2634
|
|
- if ( P->countL == 0 )
|
|
2605
|
+ P = *Q;
|
|
2606
|
+ P->start -= y_height;
|
|
2607
|
+ if ( P->start == 0 )
|
2635
|
2608
|
{
|
2636
|
|
- DelOld( &waiting, P );
|
|
2609
|
+ *Q = P->link; /* remove */
|
2637
|
2610
|
|
2638
|
2611
|
if ( P->flags & Flow_Up )
|
2639
|
2612
|
InsNew( &draw_left, P );
|
2640
|
2613
|
else
|
2641
|
2614
|
InsNew( &draw_right, P );
|
2642
|
2615
|
}
|
2643
|
|
-
|
2644
|
|
- P = Q;
|
|
2616
|
+ else
|
|
2617
|
+ Q = &P->link;
|
2645
|
2618
|
}
|
2646
|
2619
|
|
2647
|
|
- /* sort the drawing lists */
|
2648
|
|
-
|
2649
|
|
- Sort( &draw_left );
|
2650
|
|
- Sort( &draw_right );
|
2651
|
|
-
|
2652
|
2620
|
y_change = (Int)*ras.maxBuff;
|
2653
|
2621
|
y_height = y_change - y;
|
2654
|
2622
|
|
2655
|
|
- while ( y < y_change )
|
|
2623
|
+ do
|
2656
|
2624
|
{
|
2657
|
2625
|
/* let's trace */
|
2658
|
2626
|
|
... |
... |
@@ -2687,7 +2655,7 @@ |
2687
|
2655
|
P_Right->X = x2;
|
2688
|
2656
|
|
2689
|
2657
|
/* mark profile for drop-out processing */
|
2690
|
|
- P_Left->countL = 1;
|
|
2658
|
+ P_Left->start = -1;
|
2691
|
2659
|
dropouts++;
|
2692
|
2660
|
}
|
2693
|
2661
|
}
|
... |
... |
@@ -2708,34 +2676,10 @@ |
2708
|
2676
|
|
2709
|
2677
|
ras.Proc_Sweep_Step( RAS_VAR );
|
2710
|
2678
|
|
2711
|
|
- y++;
|
2712
|
|
-
|
2713
|
|
- if ( y < y_change )
|
2714
|
|
- {
|
2715
|
|
- Sort( &draw_left );
|
2716
|
|
- Sort( &draw_right );
|
2717
|
|
- }
|
2718
|
|
- }
|
2719
|
|
-
|
2720
|
|
- /* remove exhausted profiles */
|
2721
|
|
-
|
2722
|
|
- P = draw_left;
|
2723
|
|
- while ( P )
|
2724
|
|
- {
|
2725
|
|
- Q = P->link;
|
2726
|
|
- if ( P->height == 0 )
|
2727
|
|
- DelOld( &draw_left, P );
|
2728
|
|
- P = Q;
|
2729
|
|
- }
|
2730
|
|
-
|
2731
|
|
- P = draw_right;
|
2732
|
|
- while ( P )
|
2733
|
|
- {
|
2734
|
|
- Q = P->link;
|
2735
|
|
- if ( P->height == 0 )
|
2736
|
|
- DelOld( &draw_right, P );
|
2737
|
|
- P = Q;
|
|
2679
|
+ Increment( &draw_left );
|
|
2680
|
+ Increment( &draw_right );
|
2738
|
2681
|
}
|
|
2682
|
+ while ( ++y < y_change );
|
2739
|
2683
|
}
|
2740
|
2684
|
|
2741
|
2685
|
return SUCCESS;
|
... |
... |
@@ -2747,9 +2691,9 @@ |
2747
|
2691
|
|
2748
|
2692
|
while ( P_Left && P_Right )
|
2749
|
2693
|
{
|
2750
|
|
- if ( P_Left->countL )
|
|
2694
|
+ if ( P_Left->start )
|
2751
|
2695
|
{
|
2752
|
|
- P_Left->countL = 0;
|
|
2696
|
+ P_Left->start = 0;
|
2753
|
2697
|
#if 0
|
2754
|
2698
|
dropouts--; /* -- this is useful when debugging only */
|
2755
|
2699
|
#endif
|