* src/include/freetype/internal/tttypes.h (num_sbit_strikes,

num_sbit_scales): Use `FT_ULong'.
* src/sfnt/sfobjs.c (sfnt_load_face): Updated accordingly.
* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Ditto.
(find_sbit_image): Remove cast.
* src/raster/ftrend1.c (ft_raster1_render): Fix cast.

* src/sfnt/ttload.c (tt_face_load_names): Use cast.
* src/sfnt/ttcmap.c (code_to_next2): Use long constant.
(code_to_index4): Use cast.
(code_to_index8_12): Fix cast.
* src/sfnt/ttcmap0.c (tt_cmap4_char_next, tt_cmap8_char_index,
tt_cmap12_char_index): Use cast for `result'.
(tt_face_build_cmaps): Use cast.
* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_ucs4): Use cast for
`code'.
(sfnt_load_face): Use FT_Int32 for `flags'.

* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line,
gray_compute_cbox, gray_convert_glyph, gray_raster_reset): Add casts
to `TCoord' and `int'.
More 16bit fixes.
s/FT_Pos/TPos/.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Add casts.
This commit is contained in:
Werner Lemberg 2002-09-28 16:40:57 +00:00
parent 6f708265ca
commit 901933beda
10 changed files with 118 additions and 82 deletions

View File

@ -1,3 +1,32 @@
2002-09-27 Werner Lemberg <wl@gnu.org>
* src/include/freetype/internal/tttypes.h (num_sbit_strikes,
num_sbit_scales): Use `FT_ULong'.
* src/sfnt/sfobjs.c (sfnt_load_face): Updated accordingly.
* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Ditto.
(find_sbit_image): Remove cast.
* src/raster/ftrend1.c (ft_raster1_render): Fix cast.
2002-09-27 Wolfgang Domröse <porthos.domroese@harz.de>
* src/sfnt/ttload.c (tt_face_load_names): Use cast.
* src/sfnt/ttcmap.c (code_to_next2): Use long constant.
(code_to_index4): Use cast.
(code_to_index8_12): Fix cast.
* src/sfnt/ttcmap0.c (tt_cmap4_char_next, tt_cmap8_char_index,
tt_cmap12_char_index): Use cast for `result'.
(tt_face_build_cmaps): Use cast.
* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_ucs4): Use cast for
`code'.
(sfnt_load_face): Use FT_Int32 for `flags'.
* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line,
gray_compute_cbox, gray_convert_glyph, gray_raster_reset): Add casts
to `TCoord' and `int'.
More 16bit fixes.
s/FT_Pos/TPos/.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Add casts.
2002-09-26 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,

View File

@ -1518,10 +1518,10 @@ FT_BEGIN_HEADER
TT_PCLT pclt;
/* embedded bitmaps support */
FT_Int num_sbit_strikes;
FT_ULong num_sbit_strikes;
TT_SBit_Strike sbit_strikes;
FT_Int num_sbit_scales;
FT_ULong num_sbit_scales;
TT_SBit_Scale sbit_scales;
/* postscript names table */

View File

@ -200,8 +200,8 @@
goto Exit;
slot->format = FT_GLYPH_FORMAT_BITMAP;
slot->bitmap_left = (FT_UInt)( cbox.xMin >> 6 );
slot->bitmap_top = (FT_UInt)( cbox.yMax >> 6 );
slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 );
slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 );
Exit:
return error;

View File

@ -86,7 +86,7 @@
for ( n = 0; n < len; n++ )
{
code = FT_NEXT_ULONG( read );
code = (FT_UInt)FT_NEXT_ULONG( read );
if ( code < 32 || code > 127 )
code = '?';
@ -515,7 +515,7 @@
/* now set up root fields */
{
FT_Face root = &face->root;
FT_Int flags = 0;
FT_Int32 flags = 0;
FT_Memory memory;
@ -617,7 +617,7 @@
if ( face->num_sbit_strikes )
{
FT_Int n;
FT_ULong n;
root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;

View File

@ -629,7 +629,7 @@
* This is relatively simplistic -- look for a subHeader containing
* glyphs and then walk to the first glyph in that subHeader.
*/
while ( charCode < 0x10000 )
while ( charCode < 0x10000L )
{
char_lo = (FT_UInt)( charCode & 0xFF );
char_hi = charCode >> 8;
@ -746,7 +746,7 @@
/* directly */
if ( seg4->idRangeOffset == 0 )
result = ( charCode + seg4->idDelta ) & 0xFFFFU;
result = (FT_UInt)( charCode + seg4->idDelta ) & 0xFFFFU;
else
{
/* otherwise, we must use the glyphIdArray to do it */
@ -971,7 +971,8 @@
cmap8_12->last_group = group;
Found1:
return group->startGlyphID + (FT_UInt)( charCode - group->startCharCode );
return (FT_UInt)( group->startGlyphID +
( charCode - group->startCharCode ) );
}

View File

@ -940,7 +940,7 @@
code++;
}
return result;
return (FT_UInt)result;
Exit:
*pchar_code = result;
@ -1281,7 +1281,7 @@
if ( char_code <= end )
{
result = start_id + char_code - start;
result = (FT_UInt)( start_id + char_code - start );
break;
}
}
@ -1588,7 +1588,7 @@
if ( char_code <= end )
{
result = start_id + char_code - start;
result = (FT_UInt)( start_id + char_code - start );
break;
}
}
@ -1747,7 +1747,7 @@
ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
FT_VALIDATE_DEFAULT );
valid.num_glyphs = face->root.num_glyphs;
valid.num_glyphs = (FT_UInt)face->root.num_glyphs;
if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 )
{

View File

@ -1139,7 +1139,7 @@
entry++;
}
table->numNameRecords = entry - table->names;
table->numNameRecords = (FT_UInt)( entry - table->names );
}
FT_FRAME_EXIT();

View File

@ -626,7 +626,7 @@
FT_Int y_ppem,
FT_ULong *astrike_index )
{
FT_Int i;
FT_ULong i;
if ( x_ppem < 0 || x_ppem > 255 ||
@ -791,8 +791,8 @@
TT_SBit_Strike strike;
if ( !face->sbit_strikes ||
( face->num_sbit_strikes <= (FT_Int)strike_index ) )
if ( !face->sbit_strikes ||
( face->num_sbit_strikes <= strike_index ) )
goto Fail;
strike = &face->sbit_strikes[strike_index];

View File

@ -367,8 +367,8 @@
return;
}
ras.min_ex = ras.max_ex = vec->x;
ras.min_ey = ras.max_ey = vec->y;
ras.min_ex = ras.max_ex = (TCoord)vec->x;
ras.min_ey = ras.max_ey = (TCoord)vec->y;
vec++;
@ -378,10 +378,10 @@
TPos y = vec->y;
if ( x < ras.min_ex ) ras.min_ex = x;
if ( x > ras.max_ex ) ras.max_ex = x;
if ( y < ras.min_ey ) ras.min_ey = y;
if ( y > ras.max_ey ) ras.max_ey = y;
if ( x < ras.min_ex ) ras.min_ex = (TCoord)x;
if ( x > ras.max_ex ) ras.max_ex = (TCoord)x;
if ( y < ras.min_ey ) ras.min_ey = (TCoord)y;
if ( y > ras.max_ey ) ras.max_ey = (TCoord)y;
}
/* truncate the bounding box to integer pixels */
@ -513,10 +513,10 @@
dx = x2 - x1;
ex1 = TRUNC( x1 ); /* if (ex1 >= ras.max_ex) ex1 = ras.max_ex-1; */
ex2 = TRUNC( x2 ); /* if (ex2 >= ras.max_ex) ex2 = ras.max_ex-1; */
fx1 = x1 - SUBPIXELS( ex1 );
fx2 = x2 - SUBPIXELS( ex2 );
ex1 = (TCoord)TRUNC( x1 ); /* if (ex1 >= ras.max_ex) ex1 = ras.max_ex-1; */
ex2 = (TCoord)TRUNC( x2 ); /* if (ex2 >= ras.max_ex) ex2 = ras.max_ex-1; */
fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) );
fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) );
/* trivial case. Happens often */
if ( y1 == y2 )
@ -550,12 +550,12 @@
dx = -dx;
}
delta = p / dx;
mod = p % dx;
delta = (TCoord)( p / dx );
mod = (TCoord)( p % dx );
if ( mod < 0 )
{
delta--;
mod += dx;
mod += (TCoord)dx;
}
ras.area += (TArea)( fx1 + first ) * delta;
@ -568,12 +568,12 @@
if ( ex1 != ex2 )
{
p = ONE_PIXEL * ( y2 - y1 + delta );
lift = p / dx;
rem = p % dx;
lift = (TCoord)( p / dx );
rem = (TCoord)( p % dx );
if ( rem < 0 )
{
lift--;
rem += dx;
rem += (TCoord)dx;
}
mod -= dx;
@ -584,7 +584,7 @@
mod += rem;
if ( mod >= 0 )
{
mod -= dx;
mod -= (TCoord)dx;
delta++;
}
@ -612,13 +612,14 @@
{
TCoord ey1, ey2, fy1, fy2;
TPos dx, dy, x, x2;
int p, rem, mod, lift, delta, first, incr;
long p, first;
int delta, rem, mod, lift, incr;
ey1 = TRUNC( ras.last_ey );
ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */
fy1 = ras.y - ras.last_ey;
fy2 = to_y - SUBPIXELS( ey2 );
ey1 = (TCoord)TRUNC( ras.last_ey );
ey2 = (TCoord)TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */
fy1 = (TCoord)( ras.y - ras.last_ey );
fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) );
dx = to_x - ras.x;
dy = to_y - ras.y;
@ -654,8 +655,8 @@
if ( dx == 0 )
{
TCoord ex = TRUNC( ras.x );
TCoord two_fx = ( ras.x - SUBPIXELS( ex ) ) << 1;
TCoord ex = (TCoord)TRUNC( ras.x );
TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( (TPos)ex ) ) << 1 );
TPos area;
@ -666,16 +667,16 @@
incr = -1;
}
delta = first - fy1;
delta = (int)( first - fy1 );
ras.area += (TArea)two_fx * delta;
ras.cover += delta;
ey1 += incr;
gray_set_cell( raster, ex, ey1 );
delta = first + first - ONE_PIXEL;
delta = (int)( first + first - ONE_PIXEL );
area = (TArea)two_fx * delta;
while( ey1 != ey2 )
while ( ey1 != ey2 )
{
ras.area += area;
ras.cover += delta;
@ -683,50 +684,50 @@
gray_set_cell( raster, ex, ey1 );
}
delta = fy2 - ONE_PIXEL + first;
delta = (int)( fy2 - ONE_PIXEL + first );
ras.area += (TArea)two_fx * delta;
ras.cover += delta;
goto End;
}
/* ok, we have to render several scanlines */
p = ( ONE_PIXEL - fy1 ) * dx;
first = ONE_PIXEL;
p = (int)( ( ONE_PIXEL - fy1 ) * dx );
first = (int)ONE_PIXEL;
incr = 1;
if ( dy < 0 )
{
p = fy1 * dx;
p = fy1 * (int)dx;
first = 0;
incr = -1;
dy = -dy;
}
delta = p / dy;
mod = p % dy;
delta = (int)( p / dy );
mod = (int)( p % dy );
if ( mod < 0 )
{
delta--;
mod += dy;
mod += (TCoord)dy;
}
x = ras.x + delta;
gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, first );
ey1 += incr;
gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );
gray_set_cell( RAS_VAR_ (TCoord)TRUNC( x ), ey1 );
if ( ey1 != ey2 )
{
p = ONE_PIXEL * dx;
lift = p / dy;
rem = p % dy;
p = (int)( ONE_PIXEL * dx );
lift = (int)( p / dy );
rem = (int)( p % dy );
if ( rem < 0 )
{
lift--;
rem += dy;
rem += (int)dy;
}
mod -= dy;
mod -= (int)dy;
while ( ey1 != ey2 )
{
@ -734,12 +735,14 @@
mod += rem;
if ( mod >= 0 )
{
mod -= dy;
mod -= (int)dy;
delta++;
}
x2 = x + delta;
gray_render_scanline( RAS_VAR_ ey1, x, ONE_PIXEL - first, x2, first );
gray_render_scanline( RAS_VAR_ ey1, x,
(TCoord)( ONE_PIXEL - first ), x2,
first );
x = x2;
ey1 += incr;
@ -747,7 +750,9 @@
}
}
gray_render_scanline( RAS_VAR_ ey1, x, ONE_PIXEL - first, to_x, fy2 );
gray_render_scanline( RAS_VAR_ ey1, x,
(TCoord)( ONE_PIXEL - first ), to_x,
fy2 );
End:
ras.x = to_x;
@ -1237,7 +1242,8 @@
x = UPSCALE( to->x );
y = UPSCALE( to->y );
gray_start_cell( (PRaster)raster, TRUNC( x ), TRUNC( y ) );
gray_start_cell( (PRaster)raster,
(TCoord)TRUNC( x ), (TCoord)TRUNC( y ) );
((PRaster)raster)->x = x;
((PRaster)raster)->y = y;
@ -1361,8 +1367,8 @@
/* */
/* the coverage percentage is area/(PIXEL_BITS*PIXEL_BITS*2) */
/* */
coverage = area >> ( PIXEL_BITS * 2 + 1 - 8); /* use range 0..256 */
coverage = (int)( area >> ( PIXEL_BITS * 2 + 1 - 8 ) );
/* use range 0..256 */
if ( coverage < 0 )
coverage = -coverage;
@ -1593,14 +1599,14 @@
FT_Vector* limit;
char* tags;
int n; /* index of contour in outline */
int first; /* index of first point in contour */
int error;
char tag; /* current point's state */
int n; /* index of contour in outline */
int first; /* index of first point in contour */
int error;
char tag; /* current point's state */
#if 0
int shift = func_interface->shift;
FT_Pos delta = func_interface->delta;
int shift = func_interface->shift;
TPos delta = func_interface->delta;
#endif
@ -1784,7 +1790,7 @@
typedef struct TBand_
{
FT_Pos min, max;
TPos min, max;
} TBand;
@ -1839,11 +1845,11 @@
ras.max_ey <= clip->yMin || ras.min_ey >= clip->yMax )
return 0;
if ( ras.min_ex < clip->xMin ) ras.min_ex = clip->xMin;
if ( ras.min_ey < clip->yMin ) ras.min_ey = clip->yMin;
if ( ras.min_ex < clip->xMin ) ras.min_ex = (TCoord)clip->xMin;
if ( ras.min_ey < clip->yMin ) ras.min_ey = (TCoord)clip->yMin;
if ( ras.max_ex > clip->xMax ) ras.max_ex = clip->xMax;
if ( ras.max_ey > clip->yMax ) ras.max_ey = clip->yMax;
if ( ras.max_ex > clip->xMax ) ras.max_ex = (TCoord)clip->xMax;
if ( ras.max_ey > clip->yMax ) ras.max_ey = (TCoord)clip->yMax;
/* simple heuristic used to speed-up the bezier decomposition -- see */
/* the code in gray_render_conic() and gray_render_cubic() for more */
@ -1886,14 +1892,14 @@
while ( band >= bands )
{
FT_Pos bottom, top, middle;
int error;
TPos bottom, top, middle;
int error;
ras.num_cells = 0;
ras.invalid = 1;
ras.min_ey = band->min;
ras.max_ey = band->max;
ras.min_ey = (TCoord)band->min;
ras.max_ey = (TCoord)band->max;
#if 1
error = gray_convert_glyph_inner( RAS_VAR );
@ -2136,7 +2142,7 @@
if ( raster && pool_base && pool_size >= 4096 )
gray_init_cells( rast, (char*)pool_base, pool_size );
rast->band_size = ( pool_size / sizeof ( TCell ) ) / 8;
rast->band_size = (int)( ( pool_size / sizeof ( TCell ) ) / 8 );
}

View File

@ -218,8 +218,8 @@
goto Exit;
slot->format = FT_GLYPH_FORMAT_BITMAP;
slot->bitmap_left = cbox.xMin >> 6;
slot->bitmap_top = cbox.yMax >> 6;
slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 );
slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 );
Exit:
if ( outline && origin )