various cleanups to reduce compiler warnings

This commit is contained in:
David Turner 2000-06-27 23:31:53 +00:00
parent 7ed5a057cf
commit 74abee8e2e
3 changed files with 131 additions and 95 deletions

View File

@ -440,8 +440,8 @@
}
BASE_FUNC( FT_Error ) FT_GlyphLoader_Create_Extra(
FT_GlyphLoader* loader )
BASE_FUNC(FT_Error) FT_GlyphLoader_Create_Extra( FT_GlyphLoader* loader )
{
FT_Error error;
FT_Memory memory = loader->memory;
@ -881,6 +881,8 @@
}
static FT_Renderer ft_lookup_glyph_renderer( FT_GlyphSlot slot );
/*************************************************************************/
/* */
/* <Function> */
@ -926,7 +928,7 @@
if ( !face || !face->size || !face->glyph )
return FT_Err_Invalid_Face_Handle;
if ( glyph_index >= face->num_glyphs )
if ( glyph_index >= (FT_UInt)face->num_glyphs )
return FT_Err_Invalid_Argument;
slot = face->glyph;
@ -1388,7 +1390,6 @@
FT_Int num_params = 0;
FT_Parameter* params = 0;
driver = FT_DRIVER( cur[0] );
if ( args->flags & ft_open_params )
@ -2213,16 +2214,20 @@
/*************************************************************************/
/* lookup a renderer by glyph format in the library's list */
static FT_Renderer ft_lookup_renderer( FT_Library library,
BASE_FUNC(FT_Renderer) FT_Lookup_Renderer( FT_Library library,
FT_Glyph_Format format,
FT_ListNode* node )
FT_ListNode *node )
{
FT_ListNode cur = library->renderers.head;
FT_Renderer result = 0;
if ( node )
if (node)
{
if (*node)
cur = (*node)->next;
*node = 0;
}
while ( cur )
{
@ -2237,6 +2242,7 @@
result = renderer;
break;
}
cur = cur->next;
}
return result;
@ -2261,7 +2267,7 @@
{
FT_Renderer renderer;
renderer = ft_lookup_renderer( library, ft_glyph_format_outline, 0 );
renderer = FT_Lookup_Renderer( library, ft_glyph_format_outline, 0 );
library->cur_renderer = renderer;
}
@ -2364,7 +2370,7 @@
FT_EXPORT_FUNC( FT_Renderer ) FT_Get_Renderer( FT_Library library,
FT_Glyph_Format format )
{
return ft_lookup_renderer( library, format, 0 );
return FT_Lookup_Renderer( library, format, 0 );
}
@ -2433,76 +2439,109 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Render_Glyph */
/* */
/* <Description> */
/* Converts a given glyph image to a bitmap. It does so by */
/* inspecting the glyph image format, find the relevant renderer, and */
/* invoke it. */
/* */
/* <Input> */
/* slot :: A handle to the glyph slot containing the image to */
/* convert. */
/* */
/* render_mode :: A set of bit flags indicating which kind of bitmap */
/* to render. For now, only */
/* `ft_render_mode_anti_alias' is supported by the */
/* available renderers, but others could appear later */
/* (e.g. optimized for TV or LCD). */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* In case of success, the renderer will be used to convert glyph */
/* images in the renderer's known format into bitmaps. */
/* */
/* This doesn't change the current renderer for other formats. */
/* */
/* The slot's native image should be considered lost after the */
/* conversion. */
/* */
FT_EXPORT_FUNC( FT_Error ) FT_Render_Glyph( FT_GlyphSlot slot,
<<<<<<< ftobjs.c
/*************************************************************************
*
* <Function>
* FT_Render_Glyph
*
* <Description>
* Converts a given glyph image to a bitmap. It does so by inspecting
* the glyph image format, find the relevant renderer, and invoke it
*
* <Input>
* slot :: handle to the glyph slot containing the image to
* convert
*
* render_mode :: a set of bit flags indicating which kind of bitmap
* to render. For now, only 'ft_render_mode_anti_alias'
* is supported by the available renderers, but others
* could appear later (e.g. LCD or TV optimised)
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* in case of success, the renderer will be used to convert glyph
* images in the renderer's known format into bitmaps.
*
* This doesn't change the current renderer for other formats..
*
* The slot's native image should be considered lost after the
* conversion..
*
*************************************************************************/
LOCAL_FUNC
FT_Error FT_Render_Glyph_Internal( FT_Library library,
FT_GlyphSlot slot,
FT_UInt render_mode )
{
FT_Error error = FT_Err_Ok;
FT_Renderer renderer;
if ( slot )
{
FT_Face face = slot->face;
FT_Library library = FT_FACE_LIBRARY( face );
/* if it is already a bitmap, no need to do anything */
switch ( slot->format )
/* if it's already a bitmap, no need to do anything */
switch (slot->format)
{
case ft_glyph_format_bitmap: /* already a bitmap, don't do anything */
break;
default:
{
FT_ListNode node = 0;
FT_Bool update = 0;
/* small shortcut for the very common case */
if ( slot->format == ft_glyph_format_outline )
if (slot->format == ft_glyph_format_outline)
{
renderer = library->cur_renderer;
node = library->renderers.head;
}
else
renderer = ft_lookup_renderer( library, slot->format, 0 );
renderer = FT_Lookup_Renderer( library, slot->format, &node );
error = FT_Err_Unimplemented_Feature;
if ( renderer )
error = renderer->render( renderer, slot, render_mode );
while (renderer)
{
error = renderer->render( renderer, slot, render_mode, 0 );
if (!error || error != FT_Err_Cannot_Render_Glyph) break;
/* FT_Err_Cannot_Render_Glyph is returned when the render mode */
/* is unsupported by the current renderer for this glyph image */
/* format.. */
/* now, look for another renderer that supports the same */
/* format.. */
renderer = FT_Lookup_Renderer( library, slot->format, &node );
update = 1;
}
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one.. */
if (!error && update && renderer)
FT_Set_Renderer( library, renderer, 0, 0 );
}
}
else
error = FT_Err_Invalid_Argument;
return error;
}
FT_EXPORT_FUNC(FT_Error) FT_Render_Glyph( FT_GlyphSlot slot,
FT_UInt render_mode )
{
FT_Library library;
if (!slot)
return FT_Err_Invalid_Argument;
library = FT_FACE_LIBRARY(slot->face);
return FT_Render_Glyph_Internal( library, slot, render_mode );
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -2904,7 +2943,7 @@
FT_EXPORT_FUNC( FT_Error ) FT_Done_Library( FT_Library library )
{
FT_Memory memory;
FT_Int n;
FT_UInt n;
if ( !library )

View File

@ -605,35 +605,33 @@
FT_Raster_Params* params )
{
FT_Error error;
FT_Renderer renderer;
if ( !library )
{
error = FT_Err_Invalid_Library_Handle;
goto Exit;
}
if ( !outline || !params )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
/* retrieve the current outline renderer */
renderer = library->cur_renderer;
if ( !renderer )
{
/* XXXX: should use another error code */
error = FT_Err_Invalid_Argument;
goto Exit;
}
FT_Bool update = 0;
FT_Renderer renderer = library->cur_renderer;
FT_ListNode node = library->renderers.head;
params->source = (void*)outline;
error = FT_Err_Cannot_Render_Glyph;
while (renderer)
{
error = renderer->raster_render( renderer->raster, params );
if (!error || error != FT_Err_Cannot_Render_Glyph) break;
/* FT_Err_Cannot_Render_Glyph is returned when the render mode */
/* is unsupported by the current renderer for this glyph image */
/* format.. */
/* now, look for another renderer that supports the same */
/* format.. */
renderer = FT_Lookup_Renderer( library, ft_glyph_format_outline, &node );
update = 1;
}
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one.. */
if (!error && update && renderer)
FT_Set_Renderer( library, renderer, 0, 0 );
Exit:
return error;
}

View File

@ -853,7 +853,7 @@
FT_GlyphLoader_Add( gloader );
for ( n = 0; n < num_subglyphs; n++ )
for ( n = 0; n < (FT_Int)num_subglyphs; n++ )
{
FT_Vector pp1, pp2;
FT_Pos x, y;
@ -915,13 +915,12 @@
if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )
{
FT_Int k = subglyph->arg1;
FT_UInt k = subglyph->arg1;
FT_UInt l = subglyph->arg2;
FT_Vector* p1;
FT_Vector* p2;
if ( start_point + k >= num_base_points ||
if ( start_point + k >= (FT_UInt)num_base_points ||
l >= (FT_UInt)num_new_points )
{
error = TT_Err_Invalid_Composite;