Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType
Commits:
-
55d0287c
by Alexei Podtelezhnikov (Алексей Подтележников) at 2023-10-25T23:23:30-04:00
[raster] Switch to routine Int instead of Short.
This is mostly cosmetic and removes a few casts, plus Short is
promoted to Int in calculations anyway.
* src/raster/ftraster.c (Vertical_Sweep_Init, Vertical_Sweep_Span,
Vertical_Sweep_Drop, Horizontal_Sweep_Init, Horizontal_Sweep_Span,
Horizontal_Sweep_Drop, Draw_Sweep): Mostly s/Short/Int/ and remove
casting.
1 changed file:
Changes:
src/raster/ftraster.c
... |
... |
@@ -394,11 +394,11 @@ |
394
|
394
|
|
395
|
395
|
/* prototypes used for sweep function dispatch */
|
396
|
396
|
typedef void
|
397
|
|
- Function_Sweep_Init( RAS_ARGS Short min,
|
398
|
|
- Short max );
|
|
397
|
+ Function_Sweep_Init( RAS_ARGS Int min,
|
|
398
|
+ Int max );
|
399
|
399
|
|
400
|
400
|
typedef void
|
401
|
|
- Function_Sweep_Span( RAS_ARGS Short y,
|
|
401
|
+ Function_Sweep_Span( RAS_ARGS Int y,
|
402
|
402
|
FT_F26Dot6 x1,
|
403
|
403
|
FT_F26Dot6 x2,
|
404
|
404
|
PProfile left,
|
... |
... |
@@ -941,7 +941,7 @@ |
941
|
941
|
Long maxy )
|
942
|
942
|
{
|
943
|
943
|
Long Dx, Dy;
|
944
|
|
- Int e1, e2, f1, f2, size; /* XXX: is `Short' sufficient? */
|
|
944
|
+ Int e1, e2, f1, f2, size;
|
945
|
945
|
Long Ix, Rx, Ax;
|
946
|
946
|
|
947
|
947
|
PLong top;
|
... |
... |
@@ -1136,7 +1136,6 @@ |
1136
|
1136
|
Long maxy )
|
1137
|
1137
|
{
|
1138
|
1138
|
Long y1, y2, e, e2, e0;
|
1139
|
|
- Short f1;
|
1140
|
1139
|
|
1141
|
1140
|
TPoint* start_arc;
|
1142
|
1141
|
|
... |
... |
@@ -1162,10 +1161,9 @@ |
1162
|
1161
|
else
|
1163
|
1162
|
{
|
1164
|
1163
|
e = CEILING( y1 );
|
1165
|
|
- f1 = (Short)( FRAC( y1 ) );
|
1166
|
1164
|
e0 = e;
|
1167
|
1165
|
|
1168
|
|
- if ( f1 == 0 )
|
|
1166
|
+ if ( FRAC( y1 ) == 0 )
|
1169
|
1167
|
{
|
1170
|
1168
|
if ( ras.joint )
|
1171
|
1169
|
{
|
... |
... |
@@ -2124,8 +2122,8 @@ |
2124
|
2122
|
*/
|
2125
|
2123
|
|
2126
|
2124
|
static void
|
2127
|
|
- Vertical_Sweep_Init( RAS_ARGS Short min,
|
2128
|
|
- Short max )
|
|
2125
|
+ Vertical_Sweep_Init( RAS_ARGS Int min,
|
|
2126
|
+ Int max )
|
2129
|
2127
|
{
|
2130
|
2128
|
FT_UNUSED( max );
|
2131
|
2129
|
|
... |
... |
@@ -2135,7 +2133,7 @@ |
2135
|
2133
|
|
2136
|
2134
|
|
2137
|
2135
|
static void
|
2138
|
|
- Vertical_Sweep_Span( RAS_ARGS Short y,
|
|
2136
|
+ Vertical_Sweep_Span( RAS_ARGS Int y,
|
2139
|
2137
|
FT_F26Dot6 x1,
|
2140
|
2138
|
FT_F26Dot6 x2,
|
2141
|
2139
|
PProfile left,
|
... |
... |
@@ -2174,8 +2172,7 @@ |
2174
|
2172
|
{
|
2175
|
2173
|
Byte* target;
|
2176
|
2174
|
|
2177
|
|
- Int c1, c2;
|
2178
|
|
- Byte f1, f2;
|
|
2175
|
+ Int c1, f1, c2, f2;
|
2179
|
2176
|
|
2180
|
2177
|
|
2181
|
2178
|
if ( e1 < 0 )
|
... |
... |
@@ -2185,11 +2182,11 @@ |
2185
|
2182
|
|
2186
|
2183
|
FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
|
2187
|
2184
|
|
2188
|
|
- c1 = (Short)( e1 >> 3 );
|
2189
|
|
- c2 = (Short)( e2 >> 3 );
|
|
2185
|
+ c1 = (Int)( e1 >> 3 );
|
|
2186
|
+ c2 = (Int)( e2 >> 3 );
|
2190
|
2187
|
|
2191
|
|
- f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
|
2192
|
|
- f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
|
|
2188
|
+ f1 = 0xFF >> ( e1 & 7 );
|
|
2189
|
+ f2 = ~0x7F >> ( e2 & 7 );
|
2193
|
2190
|
|
2194
|
2191
|
target = ras.bLine + c1;
|
2195
|
2192
|
c2 -= c1;
|
... |
... |
@@ -2215,14 +2212,14 @@ |
2215
|
2212
|
|
2216
|
2213
|
|
2217
|
2214
|
static void
|
2218
|
|
- Vertical_Sweep_Drop( RAS_ARGS Short y,
|
|
2215
|
+ Vertical_Sweep_Drop( RAS_ARGS Int y,
|
2219
|
2216
|
FT_F26Dot6 x1,
|
2220
|
2217
|
FT_F26Dot6 x2,
|
2221
|
2218
|
PProfile left,
|
2222
|
2219
|
PProfile right )
|
2223
|
2220
|
{
|
2224
|
|
- Long e1, e2, pxl;
|
2225
|
|
- Short c1, f1;
|
|
2221
|
+ Long e1, e2, pxl;
|
|
2222
|
+ Int c1, f1;
|
2226
|
2223
|
|
2227
|
2224
|
|
2228
|
2225
|
FT_TRACE7(( " y=%d x=[% .*f;% .*f]",
|
... |
... |
@@ -2340,8 +2337,8 @@ |
2340
|
2337
|
|
2341
|
2338
|
e1 = TRUNC( e1 );
|
2342
|
2339
|
|
2343
|
|
- c1 = (Short)( e1 >> 3 );
|
2344
|
|
- f1 = (Short)( e1 & 7 );
|
|
2340
|
+ c1 = (Int)( e1 >> 3 );
|
|
2341
|
+ f1 = (Int)( e1 & 7 );
|
2345
|
2342
|
|
2346
|
2343
|
if ( e1 >= 0 && e1 < ras.bWidth &&
|
2347
|
2344
|
ras.bLine[c1] & ( 0x80 >> f1 ) )
|
... |
... |
@@ -2357,10 +2354,10 @@ |
2357
|
2354
|
{
|
2358
|
2355
|
FT_TRACE7(( " -> x=%ld", e1 ));
|
2359
|
2356
|
|
2360
|
|
- c1 = (Short)( e1 >> 3 );
|
2361
|
|
- f1 = (Short)( e1 & 7 );
|
|
2357
|
+ c1 = (Int)( e1 >> 3 );
|
|
2358
|
+ f1 = (Int)( e1 & 7 );
|
2362
|
2359
|
|
2363
|
|
- ras.bLine[c1] |= (char)( 0x80 >> f1 );
|
|
2360
|
+ ras.bLine[c1] |= 0x80 >> f1;
|
2364
|
2361
|
}
|
2365
|
2362
|
|
2366
|
2363
|
Exit:
|
... |
... |
@@ -2385,8 +2382,8 @@ |
2385
|
2382
|
*/
|
2386
|
2383
|
|
2387
|
2384
|
static void
|
2388
|
|
- Horizontal_Sweep_Init( RAS_ARGS Short min,
|
2389
|
|
- Short max )
|
|
2385
|
+ Horizontal_Sweep_Init( RAS_ARGS Int min,
|
|
2386
|
+ Int max )
|
2390
|
2387
|
{
|
2391
|
2388
|
/* nothing, really */
|
2392
|
2389
|
FT_UNUSED_RASTER;
|
... |
... |
@@ -2396,7 +2393,7 @@ |
2396
|
2393
|
|
2397
|
2394
|
|
2398
|
2395
|
static void
|
2399
|
|
- Horizontal_Sweep_Span( RAS_ARGS Short y,
|
|
2396
|
+ Horizontal_Sweep_Span( RAS_ARGS Int y,
|
2400
|
2397
|
FT_F26Dot6 x1,
|
2401
|
2398
|
FT_F26Dot6 x2,
|
2402
|
2399
|
PProfile left,
|
... |
... |
@@ -2427,12 +2424,12 @@ |
2427
|
2424
|
|
2428
|
2425
|
if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
|
2429
|
2426
|
{
|
2430
|
|
- Byte f1;
|
|
2427
|
+ Int f1;
|
2431
|
2428
|
PByte bits;
|
2432
|
2429
|
|
2433
|
2430
|
|
2434
|
2431
|
bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
|
2435
|
|
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
|
|
2432
|
+ f1 = 0x80 >> ( y & 7 );
|
2436
|
2433
|
|
2437
|
2434
|
FT_TRACE7(( bits[0] & f1 ? " redundant"
|
2438
|
2435
|
: " -> y=%ld edge", e1 ));
|
... |
... |
@@ -2449,12 +2446,12 @@ |
2449
|
2446
|
|
2450
|
2447
|
if ( e2 >= 0 && (ULong)e2 < ras.target.rows )
|
2451
|
2448
|
{
|
2452
|
|
- Byte f1;
|
|
2449
|
+ Int f1;
|
2453
|
2450
|
PByte bits;
|
2454
|
2451
|
|
2455
|
2452
|
|
2456
|
2453
|
bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.target.pitch;
|
2457
|
|
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
|
|
2454
|
+ f1 = 0x80 >> ( y & 7 );
|
2458
|
2455
|
|
2459
|
2456
|
FT_TRACE7(( bits[0] & f1 ? " redundant"
|
2460
|
2457
|
: " -> y=%ld edge", e2 ));
|
... |
... |
@@ -2468,7 +2465,7 @@ |
2468
|
2465
|
|
2469
|
2466
|
|
2470
|
2467
|
static void
|
2471
|
|
- Horizontal_Sweep_Drop( RAS_ARGS Short y,
|
|
2468
|
+ Horizontal_Sweep_Drop( RAS_ARGS Int y,
|
2472
|
2469
|
FT_F26Dot6 x1,
|
2473
|
2470
|
FT_F26Dot6 x2,
|
2474
|
2471
|
PProfile left,
|
... |
... |
@@ -2476,7 +2473,7 @@ |
2476
|
2473
|
{
|
2477
|
2474
|
Long e1, e2, pxl;
|
2478
|
2475
|
PByte bits;
|
2479
|
|
- Byte f1;
|
|
2476
|
+ Int f1;
|
2480
|
2477
|
|
2481
|
2478
|
|
2482
|
2479
|
FT_TRACE7(( " x=%d y=[% .*f;% .*f]",
|
... |
... |
@@ -2559,7 +2556,7 @@ |
2559
|
2556
|
e1 = TRUNC( e1 );
|
2560
|
2557
|
|
2561
|
2558
|
bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
|
2562
|
|
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
|
|
2559
|
+ f1 = 0x80 >> ( y & 7 );
|
2563
|
2560
|
|
2564
|
2561
|
if ( e1 >= 0 &&
|
2565
|
2562
|
(ULong)e1 < ras.target.rows &&
|
... |
... |
@@ -2577,7 +2574,7 @@ |
2577
|
2574
|
FT_TRACE7(( " -> y=%ld", e1 ));
|
2578
|
2575
|
|
2579
|
2576
|
bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
|
2580
|
|
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
|
|
2577
|
+ f1 = 0x80 >> ( y & 7 );
|
2581
|
2578
|
|
2582
|
2579
|
bits[0] |= f1;
|
2583
|
2580
|
}
|
... |
... |
@@ -2607,12 +2604,11 @@ |
2607
|
2604
|
static Bool
|
2608
|
2605
|
Draw_Sweep( RAS_ARG )
|
2609
|
2606
|
{
|
2610
|
|
- Short y, y_change, y_height;
|
|
2607
|
+ Int min_Y, max_Y, top, bottom, dropouts;
|
|
2608
|
+ Int y, y_change, y_height;
|
2611
|
2609
|
|
2612
|
2610
|
PProfile P, Q, P_Left, P_Right;
|
2613
|
2611
|
|
2614
|
|
- Short min_Y, max_Y, top, bottom, dropouts;
|
2615
|
|
-
|
2616
|
2612
|
Long x1, x2, xs, e1, e2;
|
2617
|
2613
|
|
2618
|
2614
|
TProfileList waiting = NULL;
|
... |
... |
@@ -2623,15 +2619,15 @@ |
2623
|
2619
|
/* first, compute min and max Y */
|
2624
|
2620
|
|
2625
|
2621
|
P = ras.fProfile;
|
2626
|
|
- max_Y = (Short)TRUNC( ras.minY );
|
2627
|
|
- min_Y = (Short)TRUNC( ras.maxY );
|
|
2622
|
+ max_Y = (Int)TRUNC( ras.minY );
|
|
2623
|
+ min_Y = (Int)TRUNC( ras.maxY );
|
2628
|
2624
|
|
2629
|
2625
|
while ( P )
|
2630
|
2626
|
{
|
2631
|
2627
|
Q = P->link;
|
2632
|
2628
|
|
2633
|
|
- bottom = (Short)P->start;
|
2634
|
|
- top = (Short)( P->start + P->height - 1 );
|
|
2629
|
+ bottom = P->start;
|
|
2630
|
+ top = P->start + P->height - 1;
|
2635
|
2631
|
|
2636
|
2632
|
if ( min_Y > bottom )
|
2637
|
2633
|
min_Y = bottom;
|
... |
... |
@@ -2694,8 +2690,8 @@ |
2694
|
2690
|
Sort( &draw_left );
|
2695
|
2691
|
Sort( &draw_right );
|
2696
|
2692
|
|
2697
|
|
- y_change = (Short)ras.sizeBuff[-ras.numTurns--];
|
2698
|
|
- y_height = (Short)( y_change - y );
|
|
2693
|
+ y_change = (Int)ras.sizeBuff[-ras.numTurns--];
|
|
2694
|
+ y_height = y_change - y;
|
2699
|
2695
|
|
2700
|
2696
|
while ( y < y_change )
|
2701
|
2697
|
{
|
|