... |
... |
@@ -305,16 +305,6 @@ |
305
|
305
|
typedef unsigned char Byte, *PByte;
|
306
|
306
|
typedef char Bool;
|
307
|
307
|
|
308
|
|
-
|
309
|
|
- typedef union Alignment_
|
310
|
|
- {
|
311
|
|
- Long l;
|
312
|
|
- void* p;
|
313
|
|
- void (*f)(void);
|
314
|
|
-
|
315
|
|
- } Alignment, *PAlignment;
|
316
|
|
-
|
317
|
|
-
|
318
|
308
|
typedef struct TPoint_
|
319
|
309
|
{
|
320
|
310
|
Long x;
|
... |
... |
@@ -345,31 +335,28 @@ |
345
|
335
|
|
346
|
336
|
struct TProfile_
|
347
|
337
|
{
|
348
|
|
- FT_F26Dot6 X; /* current coordinate during sweep */
|
349
|
338
|
PProfile link; /* link to next profile (various purposes) */
|
|
339
|
+ PProfile next; /* next profile in same contour, used */
|
|
340
|
+ /* during drop-out control */
|
350
|
341
|
PLong offset; /* start of profile's data in render pool */
|
|
342
|
+ Long height; /* profile's height in scanlines */
|
|
343
|
+ Long start; /* profile's starting scanline */
|
351
|
344
|
UShort flags; /* Bit 0-2: drop-out mode */
|
352
|
345
|
/* Bit 3: profile orientation (up/down) */
|
353
|
346
|
/* Bit 4: is top profile? */
|
354
|
347
|
/* Bit 5: is bottom profile? */
|
355
|
|
- Long height; /* profile's height in scanlines */
|
356
|
|
- Long start; /* profile's starting scanline */
|
357
|
348
|
|
358
|
349
|
Int countL; /* number of lines to step before this */
|
359
|
350
|
/* profile becomes drawable */
|
360
|
|
-
|
361
|
|
- PProfile next; /* next profile in same contour, used */
|
362
|
|
- /* during drop-out control */
|
|
351
|
+ FT_F26Dot6 X; /* current coordinate during sweep */
|
|
352
|
+ Long x[1]; /* actually variable array of scanline */
|
|
353
|
+ /* intersections with `height` elements */
|
363
|
354
|
};
|
364
|
355
|
|
365
|
356
|
typedef PProfile TProfileList;
|
366
|
357
|
typedef PProfile* PProfileList;
|
367
|
358
|
|
368
|
359
|
|
369
|
|
-#define AlignProfileSize \
|
370
|
|
- ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( Long ) )
|
371
|
|
-
|
372
|
|
-
|
373
|
360
|
#undef RAS_ARG
|
374
|
361
|
#undef RAS_ARGS
|
375
|
362
|
#undef RAS_VAR
|
... |
... |
@@ -609,19 +596,24 @@ |
609
|
596
|
static Bool
|
610
|
597
|
Insert_Y_Turn( RAS_ARGS Int y )
|
611
|
598
|
{
|
612
|
|
- PLong y_turns;
|
613
|
|
- Int n;
|
|
599
|
+ Int n = ras.numTurns;
|
|
600
|
+ PLong y_turns = ras.maxBuff;
|
614
|
601
|
|
615
|
602
|
|
616
|
|
- n = ras.numTurns - 1;
|
617
|
|
- y_turns = ras.sizeBuff - ras.numTurns;
|
618
|
|
-
|
619
|
603
|
/* look for first y value that is <= */
|
620
|
|
- while ( n >= 0 && y < y_turns[n] )
|
621
|
|
- n--;
|
|
604
|
+ while ( n-- && y < y_turns[n] )
|
|
605
|
+ ;
|
622
|
606
|
|
623
|
607
|
/* if it is <, simply insert it, ignore if == */
|
624
|
|
- if ( n >= 0 && y > y_turns[n] )
|
|
608
|
+ if ( n < 0 || y > y_turns[n] )
|
|
609
|
+ {
|
|
610
|
+ ras.maxBuff--;
|
|
611
|
+ if ( ras.maxBuff <= ras.top )
|
|
612
|
+ {
|
|
613
|
+ ras.error = FT_THROW( Raster_Overflow );
|
|
614
|
+ return FAILURE;
|
|
615
|
+ }
|
|
616
|
+
|
625
|
617
|
do
|
626
|
618
|
{
|
627
|
619
|
Int y2 = (Int)y_turns[n];
|
... |
... |
@@ -629,18 +621,9 @@ |
629
|
621
|
|
630
|
622
|
y_turns[n] = y;
|
631
|
623
|
y = y2;
|
632
|
|
- } while ( --n >= 0 );
|
|
624
|
+ } while ( n-- >= 0 );
|
633
|
625
|
|
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
|
626
|
ras.numTurns++;
|
643
|
|
- ras.sizeBuff[-ras.numTurns] = y;
|
644
|
627
|
}
|
645
|
628
|
|
646
|
629
|
return SUCCESS;
|
... |
... |
@@ -674,7 +657,7 @@ |
674
|
657
|
if ( !ras.cProfile || ras.cProfile->height )
|
675
|
658
|
{
|
676
|
659
|
ras.cProfile = (PProfile)ras.top;
|
677
|
|
- ras.top += AlignProfileSize;
|
|
660
|
+ ras.top = ras.cProfile->x;
|
678
|
661
|
|
679
|
662
|
if ( ras.top >= ras.maxBuff )
|
680
|
663
|
{
|
... |
... |
@@ -2009,19 +1992,6 @@ |
2009
|
1992
|
/*************************************************************************/
|
2010
|
1993
|
|
2011
|
1994
|
|
2012
|
|
- /**************************************************************************
|
2013
|
|
- *
|
2014
|
|
- * Init_Linked
|
2015
|
|
- *
|
2016
|
|
- * Initializes an empty linked list.
|
2017
|
|
- */
|
2018
|
|
- static void
|
2019
|
|
- Init_Linked( TProfileList* l )
|
2020
|
|
- {
|
2021
|
|
- *l = NULL;
|
2022
|
|
- }
|
2023
|
|
-
|
2024
|
|
-
|
2025
|
1995
|
/**************************************************************************
|
2026
|
1996
|
*
|
2027
|
1997
|
* InsNew
|
... |
... |
@@ -2629,6 +2599,9 @@ |
2629
|
2599
|
*
|
2630
|
2600
|
* Generic Sweep Drawing routine
|
2631
|
2601
|
*
|
|
2602
|
+ * Note that this routine is executed with the pool containing at least
|
|
2603
|
+ * two valid profiles (up and down) and two y-turns (top and bottom).
|
|
2604
|
+ *
|
2632
|
2605
|
*/
|
2633
|
2606
|
|
2634
|
2607
|
static Bool
|
... |
... |
@@ -2642,16 +2615,10 @@ |
2642
|
2615
|
|
2643
|
2616
|
Long x1, x2, xs, e1, e2;
|
2644
|
2617
|
|
2645
|
|
- TProfileList waiting;
|
2646
|
|
- TProfileList draw_left, draw_right;
|
2647
|
|
-
|
2648
|
|
-
|
2649
|
|
- /* initialize empty linked lists */
|
|
2618
|
+ TProfileList waiting = NULL;
|
|
2619
|
+ TProfileList draw_left = NULL;
|
|
2620
|
+ TProfileList draw_right = NULL;
|
2650
|
2621
|
|
2651
|
|
- Init_Linked( &waiting );
|
2652
|
|
-
|
2653
|
|
- Init_Linked( &draw_left );
|
2654
|
|
- Init_Linked( &draw_right );
|
2655
|
2622
|
|
2656
|
2623
|
/* first, compute min and max Y */
|
2657
|
2624
|
|
... |
... |
@@ -2677,13 +2644,6 @@ |
2677
|
2644
|
P = Q;
|
2678
|
2645
|
}
|
2679
|
2646
|
|
2680
|
|
- /* check the Y-turns */
|
2681
|
|
- if ( ras.numTurns == 0 )
|
2682
|
|
- {
|
2683
|
|
- ras.error = FT_THROW( Invalid_Outline );
|
2684
|
|
- return FAILURE;
|
2685
|
|
- }
|
2686
|
|
-
|
2687
|
2647
|
/* now initialize the sweep */
|
2688
|
2648
|
|
2689
|
2649
|
ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
|
... |
... |
@@ -2703,8 +2663,7 @@ |
2703
|
2663
|
y = min_Y;
|
2704
|
2664
|
y_height = 0;
|
2705
|
2665
|
|
2706
|
|
- if ( ras.numTurns > 0 &&
|
2707
|
|
- ras.sizeBuff[-ras.numTurns] == min_Y )
|
|
2666
|
+ if ( ras.sizeBuff[-ras.numTurns] == min_Y )
|
2708
|
2667
|
ras.numTurns--;
|
2709
|
2668
|
|
2710
|
2669
|
while ( ras.numTurns > 0 )
|