本文整理汇总了C++中FT_MEM_ZERO函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_MEM_ZERO函数的具体用法?C++ FT_MEM_ZERO怎么用?C++ FT_MEM_ZERO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FT_MEM_ZERO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tt_glyphzone_new
tt_glyphzone_new( FT_Memory memory,
FT_UShort maxPoints,
FT_Short maxContours,
TT_GlyphZone zone )
{
FT_Error error;
FT_MEM_ZERO( zone, sizeof ( *zone ) );
zone->memory = memory;
if ( FT_NEW_ARRAY( zone->org, maxPoints ) ||
FT_NEW_ARRAY( zone->cur, maxPoints ) ||
FT_NEW_ARRAY( zone->orus, maxPoints ) ||
FT_NEW_ARRAY( zone->tags, maxPoints ) ||
FT_NEW_ARRAY( zone->contours, maxContours ) )
{
tt_glyphzone_done( zone );
}
else
{
zone->max_points = maxPoints;
zone->max_contours = maxContours;
}
return error;
}
示例2: FT_Alloc
FT_Alloc( FT_Memory memory,
FT_Long size,
void* *P )
{
FT_ASSERT( P != 0 );
if ( size > 0 )
{
*P = memory->alloc( memory, size );
if ( !*P )
{
FT_ERROR(( "FT_Alloc:" ));
FT_ERROR(( " Out of memory? (%ld requested)\n",
size ));
return FT_Err_Out_Of_Memory;
}
FT_MEM_ZERO( *P, size );
}
else
*P = NULL;
FT_TRACE7(( "FT_Alloc:" ));
FT_TRACE7(( " size = %ld, block = 0x%08p, ref = 0x%08p\n",
size, *P, P ));
return FT_Err_Ok;
}
示例3: ft_raster1_get_cbox
/* return the glyph's control box */
static void
ft_raster1_get_cbox( FT_Renderer render,
FT_GlyphSlot slot,
FT_BBox* cbox )
{
FT_MEM_ZERO( cbox, sizeof ( *cbox ) );
if ( slot->format == render->glyph_format )
FT_Outline_Get_CBox( &slot->outline, cbox );
}
示例4: ft_mem_alloc
ft_mem_alloc( FT_Memory memory,
FT_Long size,
FT_Error *p_error )
{
FT_Error error;
FT_Pointer block = ft_mem_qalloc( memory, size, &error );
if ( !error && size > 0 )
FT_MEM_ZERO( block, size );
*p_error = error;
return block;
}
示例5: t42_loader_init
t42_loader_init( T42_Loader loader,
T42_Face face )
{
FT_UNUSED( face );
FT_MEM_ZERO( loader, sizeof ( *loader ) );
loader->num_glyphs = 0;
loader->num_chars = 0;
/* initialize the tables -- simply set their `init' field to 0 */
loader->encoding_table.init = 0;
loader->charstrings.init = 0;
loader->glyph_names.init = 0;
}
示例6: cf2_outline_init
static void
cf2_outline_init( CF2_Outline outline,
FT_Memory memory,
FT_Error* error )
{
FT_MEM_ZERO( outline, sizeof ( CF2_OutlineRec ) );
outline->root.memory = memory;
outline->root.error = error;
outline->root.moveTo = cf2_builder_moveTo;
outline->root.lineTo = cf2_builder_lineTo;
outline->root.cubeTo = cf2_builder_cubeTo;
}
示例7: ft_mem_table_new
static FT_MemTable
ft_mem_table_new( FT_Memory memory )
{
FT_MemTable table;
table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );
if ( table == NULL )
goto Exit;
FT_MEM_ZERO( table, sizeof ( *table ) );
table->size = FT_MEM_SIZE_MIN;
table->nodes = 0;
table->memory = memory;
table->memory_user = memory->user;
table->alloc = memory->alloc;
table->realloc = memory->realloc;
table->free = memory->free;
table->buckets = (FT_MemNode *)
memory->alloc( memory,
table->size * sizeof ( FT_MemNode ) );
if ( table->buckets )
FT_MEM_ZERO( table->buckets, sizeof ( FT_MemNode ) * table->size );
else
{
memory->free( memory, table );
table = NULL;
}
Exit:
return table;
}
示例8: ft_mem_table_resize
static void
ft_mem_table_resize( FT_MemTable table )
{
FT_ULong new_size;
new_size = ft_mem_closest_prime( table->nodes );
if ( new_size != table->size )
{
FT_MemNode* new_buckets ;
FT_ULong i;
new_buckets = (FT_MemNode *)
ft_mem_table_alloc( table,
new_size * sizeof ( FT_MemNode ) );
if ( new_buckets == NULL )
return;
FT_MEM_ZERO( new_buckets, sizeof ( FT_MemNode ) * new_size );
for ( i = 0; i < table->size; i++ )
{
FT_MemNode node, next, *pnode;
FT_ULong hash;
node = table->buckets[i];
while ( node )
{
next = node->link;
hash = FT_MEM_VAL( node->address ) % new_size;
pnode = new_buckets + hash;
node->link = pnode[0];
pnode[0] = node;
node = next;
}
}
if ( table->buckets )
ft_mem_table_free( table, table->buckets );
table->buckets = new_buckets;
table->size = new_size;
}
}
示例9: cff_index_done
static void
cff_index_done( CFF_Index idx )
{
if ( idx->stream )
{
FT_Stream stream = idx->stream;
FT_Memory memory = stream->memory;
if ( idx->bytes )
FT_FRAME_RELEASE( idx->bytes );
FT_FREE( idx->offsets );
FT_MEM_ZERO( idx, sizeof ( *idx ) );
}
}
示例10: cff_make_private_dict
static void
cff_make_private_dict( CFF_SubFont subfont,
PS_Private priv )
{
CFF_Private cpriv = &subfont->private_dict;
FT_UInt n, count;
FT_MEM_ZERO( priv, sizeof ( *priv ) );
count = priv->num_blue_values = cpriv->num_blue_values;
for ( n = 0; n < count; n++ )
priv->blue_values[n] = (FT_Short)cpriv->blue_values[n];
count = priv->num_other_blues = cpriv->num_other_blues;
for ( n = 0; n < count; n++ )
priv->other_blues[n] = (FT_Short)cpriv->other_blues[n];
count = priv->num_family_blues = cpriv->num_family_blues;
for ( n = 0; n < count; n++ )
priv->family_blues[n] = (FT_Short)cpriv->family_blues[n];
count = priv->num_family_other_blues = cpriv->num_family_other_blues;
for ( n = 0; n < count; n++ )
priv->family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
priv->blue_scale = cpriv->blue_scale;
priv->blue_shift = (FT_Int)cpriv->blue_shift;
priv->blue_fuzz = (FT_Int)cpriv->blue_fuzz;
priv->standard_width[0] = (FT_UShort)cpriv->standard_width;
priv->standard_height[0] = (FT_UShort)cpriv->standard_height;
count = priv->num_snap_widths = cpriv->num_snap_widths;
for ( n = 0; n < count; n++ )
priv->snap_widths[n] = (FT_Short)cpriv->snap_widths[n];
count = priv->num_snap_heights = cpriv->num_snap_heights;
for ( n = 0; n < count; n++ )
priv->snap_heights[n] = (FT_Short)cpriv->snap_heights[n];
priv->force_bold = cpriv->force_bold;
priv->language_group = cpriv->language_group;
priv->lenIV = cpriv->lenIV;
}
示例11: ft_mem_realloc
ft_mem_realloc( FT_Memory memory,
FT_Long item_size,
FT_Long cur_count,
FT_Long new_count,
void* block,
FT_Error *p_error )
{
FT_Error error = FT_Err_Ok;
block = ft_mem_qrealloc( memory, item_size,
cur_count, new_count, block, &error );
if ( !error && new_count > cur_count )
FT_MEM_ZERO( (char*)block + cur_count * item_size,
( new_count - cur_count ) * item_size );
*p_error = error;
return block;
}
示例12: ft_mem_realloc
ft_mem_realloc( FT_Memory memory,
FT_Long item_size,
FT_Long cur_count,
FT_Long new_count,
void* block,
FT_Error *p_error )
{
FT_Error error = FT_Err_Ok;
block = ft_mem_qrealloc( memory, item_size,
cur_count, new_count, block, &error );
//if ( !error && new_count > cur_count )
if ( !error && (FT_ULong)new_count > (FT_ULong)cur_count ) /* cast to ulong because otherwise the compiler may warn that it's assuming signed integers can't overflow. */
FT_MEM_ZERO( (char*)block + cur_count * item_size,
( new_count - cur_count ) * item_size );
*p_error = error;
return block;
}
示例13: t1_decoder_init
t1_decoder_init( T1_Decoder decoder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Byte** glyph_names,
PS_Blend blend,
FT_Bool hinting,
FT_Render_Mode hint_mode,
T1_Decoder_Callback parse_callback )
{
FT_MEM_ZERO( decoder, sizeof ( *decoder ) );
/* retrieve PSNames interface from list of current modules */
{
FT_Service_PsCMaps psnames = 0;
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
if ( !psnames )
{
FT_ERROR(( "t1_decoder_init: " ));
FT_ERROR(( "the `psnames' module is not available\n" ));
return PSaux_Err_Unimplemented_Feature;
}
decoder->psnames = psnames;
}
t1_builder_init( &decoder->builder, face, size, slot, hinting );
decoder->num_glyphs = (FT_UInt)face->num_glyphs;
decoder->glyph_names = glyph_names;
decoder->hint_mode = hint_mode;
decoder->blend = blend;
decoder->parse_callback = parse_callback;
decoder->funcs = t1_decoder_funcs;
return 0;
}
示例14: FT_Realloc
FT_Realloc( FT_Memory memory,
FT_Long current,
FT_Long size,
void** P )
{
void* Q;
FT_ASSERT( P != 0 );
/* if the original pointer is NULL, call FT_Alloc() */
if ( !*P )
return FT_Alloc( memory, size, P );
/* if the new block if zero-sized, clear the current one */
if ( size <= 0 )
{
FT_Free( memory, P );
return FT_Err_Ok;
}
Q = memory->realloc( memory, current, size, *P );
if ( !Q )
goto Fail;
if ( size > current )
FT_MEM_ZERO( (char*)Q + current, size - current );
*P = Q;
return FT_Err_Ok;
Fail:
FT_ERROR(( "FT_Realloc:" ));
FT_ERROR(( " Failed (current %ld, requested %ld)\n",
current, size ));
return FT_Err_Out_Of_Memory;
}
示例15: ft_bitmap_assure_buffer
static FT_Error
ft_bitmap_assure_buffer( FT_Memory memory,
FT_Bitmap* bitmap,
FT_UInt xpixels,
FT_UInt ypixels )
{
FT_Error error;
int pitch;
int new_pitch;
FT_UInt bpp;
FT_Int i, width, height;
unsigned char* buffer = NULL;
width = bitmap->width;
height = bitmap->rows;
pitch = bitmap->pitch;
if ( pitch < 0 )
pitch = -pitch;
switch ( bitmap->pixel_mode )
{
case FT_PIXEL_MODE_MONO:
bpp = 1;
new_pitch = ( width + xpixels + 7 ) >> 3;
break;
case FT_PIXEL_MODE_GRAY2:
bpp = 2;
new_pitch = ( width + xpixels + 3 ) >> 2;
break;
case FT_PIXEL_MODE_GRAY4:
bpp = 4;
new_pitch = ( width + xpixels + 1 ) >> 1;
break;
case FT_PIXEL_MODE_GRAY:
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
bpp = 8;
new_pitch = ( width + xpixels );
break;
default:
return FT_THROW( Invalid_Glyph_Format );
}
/* if no need to allocate memory */
if ( ypixels == 0 && new_pitch <= pitch )
{
/* zero the padding */
FT_Int bit_width = pitch * 8;
FT_Int bit_last = ( width + xpixels ) * bpp;
if ( bit_last < bit_width )
{
FT_Byte* line = bitmap->buffer + ( bit_last >> 3 );
FT_Byte* end = bitmap->buffer + pitch;
FT_Int shift = bit_last & 7;
FT_UInt mask = 0xFF00U >> shift;
FT_Int count = height;
for ( ; count > 0; count--, line += pitch, end += pitch )
{
FT_Byte* write = line;
if ( shift > 0 )
{
write[0] = (FT_Byte)( write[0] & mask );
write++;
}
if ( write < end )
FT_MEM_ZERO( write, end-write );
}
}