... |
... |
@@ -448,7 +448,6 @@ |
448
|
448
|
Int precision_half;
|
449
|
449
|
Int precision_scale;
|
450
|
450
|
Int precision_step;
|
451
|
|
- Int precision_jitter;
|
452
|
451
|
|
453
|
452
|
PLong buff; /* The profiles buffer */
|
454
|
453
|
PLong sizeBuff; /* Render pool size */
|
... |
... |
@@ -549,27 +548,17 @@ |
549
|
548
|
*
|
550
|
549
|
* 256 / (1 << 12) = 0.0625 pixels.
|
551
|
550
|
*
|
552
|
|
- * `precision_jitter' is an epsilon threshold used in
|
553
|
|
- * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier
|
554
|
|
- * decomposition (after all, we are working with approximations only);
|
555
|
|
- * it avoids switching on additional pixels which would cause artifacts
|
556
|
|
- * otherwise.
|
557
|
|
- *
|
558
|
|
- * The value of `precision_jitter' has been determined heuristically.
|
559
|
|
- *
|
560
|
551
|
*/
|
561
|
552
|
|
562
|
553
|
if ( High )
|
563
|
554
|
{
|
564
|
555
|
ras.precision_bits = 12;
|
565
|
556
|
ras.precision_step = 256;
|
566
|
|
- ras.precision_jitter = 30;
|
567
|
557
|
}
|
568
|
558
|
else
|
569
|
559
|
{
|
570
|
560
|
ras.precision_bits = 6;
|
571
|
561
|
ras.precision_step = 32;
|
572
|
|
- ras.precision_jitter = 2;
|
573
|
562
|
}
|
574
|
563
|
|
575
|
564
|
ras.precision = 1 << ras.precision_bits;
|
... |
... |
@@ -1135,7 +1124,8 @@ |
1135
|
1124
|
Long miny,
|
1136
|
1125
|
Long maxy )
|
1137
|
1126
|
{
|
1138
|
|
- Long y1, y2, e, e2, e0;
|
|
1127
|
+ Long y1, y2, e, e2, e0, dy;
|
|
1128
|
+ Long dx, x2;
|
1139
|
1129
|
|
1140
|
1130
|
TPoint* start_arc;
|
1141
|
1131
|
|
... |
... |
@@ -1200,19 +1190,25 @@ |
1200
|
1190
|
ras.joint = FALSE;
|
1201
|
1191
|
|
1202
|
1192
|
y2 = arc[0].y;
|
|
1193
|
+ x2 = arc[0].x;
|
1203
|
1194
|
|
1204
|
1195
|
if ( y2 > e )
|
1205
|
1196
|
{
|
1206
|
|
- y1 = arc[degree].y;
|
1207
|
|
- if ( y2 - y1 >= ras.precision_step )
|
|
1197
|
+ dy = y2 - arc[degree].y;
|
|
1198
|
+ dx = x2 - arc[degree].x;
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+ /* split condition should be invariant of direction */
|
|
1202
|
+ if ( dy > ras.precision_step ||
|
|
1203
|
+ dx > ras.precision_step ||
|
|
1204
|
+ -dx > ras.precision_step )
|
1208
|
1205
|
{
|
1209
|
1206
|
splitter( arc );
|
1210
|
1207
|
arc += degree;
|
1211
|
1208
|
}
|
1212
|
1209
|
else
|
1213
|
1210
|
{
|
1214
|
|
- *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
|
1215
|
|
- e - y1, y2 - y1 );
|
|
1211
|
+ *top++ = x2 - FMulDiv( y2 - e, dx, dy );
|
1216
|
1212
|
arc -= degree;
|
1217
|
1213
|
e += ras.precision;
|
1218
|
1214
|
}
|
... |
... |
@@ -1222,7 +1218,7 @@ |
1222
|
1218
|
if ( y2 == e )
|
1223
|
1219
|
{
|
1224
|
1220
|
ras.joint = TRUE;
|
1225
|
|
- *top++ = arc[0].x;
|
|
1221
|
+ *top++ = x2;
|
1226
|
1222
|
|
1227
|
1223
|
e += ras.precision;
|
1228
|
1224
|
}
|
... |
... |
@@ -2139,9 +2135,7 @@ |
2139
|
2135
|
PProfile left,
|
2140
|
2136
|
PProfile right )
|
2141
|
2137
|
{
|
2142
|
|
- Long e1, e2;
|
2143
|
|
-
|
2144
|
|
- Int dropOutControl = left->flags & 7;
|
|
2138
|
+ Int e1, e2;
|
2145
|
2139
|
|
2146
|
2140
|
FT_UNUSED( y );
|
2147
|
2141
|
FT_UNUSED( left );
|
... |
... |
@@ -2153,20 +2147,8 @@ |
2153
|
2147
|
ras.precision_bits, (double)x1 / (double)ras.precision,
|
2154
|
2148
|
ras.precision_bits, (double)x2 / (double)ras.precision ));
|
2155
|
2149
|
|
2156
|
|
- /* Drop-out control */
|
2157
|
|
-
|
2158
|
|
- e1 = CEILING( x1 );
|
2159
|
|
- e2 = FLOOR( x2 );
|
2160
|
|
-
|
2161
|
|
- /* take care of the special case where both the left */
|
2162
|
|
- /* and right contour lie exactly on pixel centers */
|
2163
|
|
- if ( dropOutControl != 2 &&
|
2164
|
|
- x2 - x1 - ras.precision <= ras.precision_jitter &&
|
2165
|
|
- e1 != x1 && e2 != x2 )
|
2166
|
|
- e2 = e1;
|
2167
|
|
-
|
2168
|
|
- e1 = TRUNC( e1 );
|
2169
|
|
- e2 = TRUNC( e2 );
|
|
2150
|
+ e1 = (Int)TRUNC( CEILING( x1 ) );
|
|
2151
|
+ e2 = (Int)TRUNC( FLOOR( x2 ) );
|
2170
|
2152
|
|
2171
|
2153
|
if ( e2 >= 0 && e1 < ras.bWidth )
|
2172
|
2154
|
{
|
... |
... |
@@ -2180,10 +2162,10 @@ |
2180
|
2162
|
if ( e2 >= ras.bWidth )
|
2181
|
2163
|
e2 = ras.bWidth - 1;
|
2182
|
2164
|
|
2183
|
|
- FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
|
|
2165
|
+ FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
|
2184
|
2166
|
|
2185
|
|
- c1 = (Int)( e1 >> 3 );
|
2186
|
|
- c2 = (Int)( e2 >> 3 );
|
|
2167
|
+ c1 = e1 >> 3;
|
|
2168
|
+ c2 = e2 >> 3;
|
2187
|
2169
|
|
2188
|
2170
|
f1 = 0xFF >> ( e1 & 7 );
|
2189
|
2171
|
f2 = ~0x7F >> ( e2 & 7 );
|
... |
... |
@@ -2609,8 +2591,6 @@ |
2609
|
2591
|
|
2610
|
2592
|
PProfile P, Q, P_Left, P_Right;
|
2611
|
2593
|
|
2612
|
|
- Long x1, x2, xs, e1, e2;
|
2613
|
|
-
|
2614
|
2594
|
TProfileList waiting = ras.fProfile;
|
2615
|
2595
|
TProfileList draw_left = NULL;
|
2616
|
2596
|
TProfileList draw_right = NULL;
|
... |
... |
@@ -2683,8 +2663,10 @@ |
2683
|
2663
|
|
2684
|
2664
|
while ( P_Left && P_Right )
|
2685
|
2665
|
{
|
2686
|
|
- x1 = P_Left ->X;
|
2687
|
|
- x2 = P_Right->X;
|
|
2666
|
+ Long x1 = P_Left ->X;
|
|
2667
|
+ Long x2 = P_Right->X;
|
|
2668
|
+ Long xs;
|
|
2669
|
+
|
2688
|
2670
|
|
2689
|
2671
|
if ( x1 > x2 )
|
2690
|
2672
|
{
|
... |
... |
@@ -2693,36 +2675,24 @@ |
2693
|
2675
|
x2 = xs;
|
2694
|
2676
|
}
|
2695
|
2677
|
|
2696
|
|
- e1 = FLOOR( x1 );
|
2697
|
|
- e2 = CEILING( x2 );
|
2698
|
|
-
|
2699
|
|
- if ( x2 - x1 <= ras.precision &&
|
2700
|
|
- e1 != x1 && e2 != x2 )
|
|
2678
|
+ /* if bottom ceiling exceeds top floor, it is a drop-out */
|
|
2679
|
+ if ( CEILING( x1 ) > FLOOR( x2 ) )
|
2701
|
2680
|
{
|
2702
|
|
- if ( e1 > e2 || e2 == e1 + ras.precision )
|
2703
|
|
- {
|
2704
|
|
- Int dropOutControl = P_Left->flags & 7;
|
2705
|
|
-
|
|
2681
|
+ Int dropOutControl = P_Left->flags & 7;
|
2706
|
2682
|
|
2707
|
|
- if ( dropOutControl != 2 )
|
2708
|
|
- {
|
2709
|
|
- /* a drop-out was detected */
|
2710
|
2683
|
|
2711
|
|
- P_Left ->X = x1;
|
2712
|
|
- P_Right->X = x2;
|
2713
|
|
-
|
2714
|
|
- /* mark profile for drop-out processing */
|
2715
|
|
- P_Left->countL = 1;
|
2716
|
|
- dropouts++;
|
2717
|
|
- }
|
|
2684
|
+ if ( dropOutControl != 2 )
|
|
2685
|
+ {
|
|
2686
|
+ P_Left ->X = x1;
|
|
2687
|
+ P_Right->X = x2;
|
2718
|
2688
|
|
2719
|
|
- goto Skip_To_Next;
|
|
2689
|
+ /* mark profile for drop-out processing */
|
|
2690
|
+ P_Left->countL = 1;
|
|
2691
|
+ dropouts++;
|
2720
|
2692
|
}
|
2721
|
2693
|
}
|
2722
|
|
-
|
2723
|
|
- ras.Proc_Sweep_Span( RAS_VARS y, x1, x2, P_Left, P_Right );
|
2724
|
|
-
|
2725
|
|
- Skip_To_Next:
|
|
2694
|
+ else
|
|
2695
|
+ ras.Proc_Sweep_Span( RAS_VARS y, x1, x2, P_Left, P_Right );
|
2726
|
2696
|
|
2727
|
2697
|
P_Left = P_Left->link;
|
2728
|
2698
|
P_Right = P_Right->link;
|