Edit

kc3-lang/freetype/src/cache/ftcglyph.c

Branch :

  • Show log

    Commit

  • Author : Werner Lemberg
    Date : 2004-05-17 09:25:04
    Hash : e260d253
    Message : * src/cache/ftcbasic.c (ftc_basic_family_compare, ftc_basic_family_init, ftc_basic_family_get_count, ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph, ftc_basic_gnode_compare_faceid): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. (ftc_basic_image_family_class, ftc_basic_image_cache_class, ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove casts. * src/cache/ftccback.h: Adjust parameters and return types to prototypes given in header files from include/freetype/cache. * src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new, ftc_inode_weight): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. * src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new, ftc_snode_weight, ftc_snode_compare): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. * src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new, ftc_cmap_node_weight, ftc_cmap_node_compare, ftc_cmap_node_remove_faceid): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. (ftc_cmap_cache_class): Remove casts. * src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. * src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare, ftc_size_node_init, ftc_size_node_reset, ftc_size_node_compare_faceid, ftc_face_node_init, ftc_face_node_done, ftc_face_node_compare: Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. (ftc_size_list_class, ftc_face_list_class): Remove casts. * src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done): Use FT_Module as parameter and do a cast to FT_AutoHinter locally. (autohint_module_class): Remove casts. * src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy, ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init, ft_outline_glyph_done, ft_outline_glyph_copy, ft_outline_glyph_transform, ft_outline_glyph_bbox, ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast to FT_XXXGlyph locally. Use FT_CALLBACK_DEF throughout. (ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts. * src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done, bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter and do a cast to BDF_CMap locally. (bdf_cmap_class): Remove casts.

  • src/cache/ftcglyph.c
  • /***************************************************************************/
    /*                                                                         */
    /*  ftcglyph.c                                                             */
    /*                                                                         */
    /*    FreeType Glyph Image (FT_Glyph) cache (body).                        */
    /*                                                                         */
    /*  Copyright 2000-2001, 2003, 2004 by                                     */
    /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    /*                                                                         */
    /*  This file is part of the FreeType project, and may only be used,       */
    /*  modified, and distributed under the terms of the FreeType project      */
    /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    /*  this file you indicate that you have read the license and              */
    /*  understand and accept it fully.                                        */
    /*                                                                         */
    /***************************************************************************/
    
    
    #include <ft2build.h>
    #include FT_CACHE_H
    #include FT_CACHE_INTERNAL_GLYPH_H
    #include FT_ERRORS_H
    #include FT_INTERNAL_OBJECTS_H
    #include FT_INTERNAL_DEBUG_H
    
    #include "ftccback.h"
    #include "ftcerror.h"
    
    
      /* create a new chunk node, setting its cache index and ref count */
      FT_EXPORT_DEF( void )
      FTC_GNode_Init( FTC_GNode   gnode,
                      FT_UInt     gindex,
                      FTC_Family  family )
      {
        gnode->family = family;
        gnode->gindex = gindex;
        family->num_nodes++;
      }
    
    
      FT_EXPORT_DEF( void )
      FTC_GNode_UnselectFamily( FTC_GNode  gnode,
                                FTC_Cache  cache )
      {
        FTC_Family  family = gnode->family;
    
    
        gnode->family = NULL;
        if ( family && --family->num_nodes <= 0 )
          FTC_MruList_Remove( &FTC_GCACHE( cache )->families,
                              (FTC_MruNode)family );
      }
    
    
      FT_EXPORT_DEF( void )
      FTC_GNode_Done( FTC_GNode  gnode,
                      FTC_Cache  cache )
      {
        /* finalize the node */
        gnode->gindex = 0;
    
        FTC_GNode_UnselectFamily( gnode, cache );
      }
    
    
      FT_EXPORT_DEF( FT_Bool )
      FTC_GNode_Compare( FTC_GNode   gnode,
                         FTC_GQuery  gquery )
      {
        return FT_BOOL(  gnode->family == gquery->family &&
                         gnode->gindex == gquery->gindex );
      }
    
    
      FT_LOCAL_DEF( FT_Bool )
      ftc_gnode_compare( FTC_Node    ftcgnode,
                         FT_Pointer  ftcgquery,
                         FTC_Cache   cache )
      {
        FTC_GNode   gnode  = (FTC_GNode)ftcgnode;
        FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;
        FT_UNUSED( cache );
    
    
        return FTC_GNode_Compare( gnode, gquery );
      }
    
    
      /*************************************************************************/
      /*************************************************************************/
      /*****                                                               *****/
      /*****                      CHUNK SETS                               *****/
      /*****                                                               *****/
      /*************************************************************************/
      /*************************************************************************/
    
      FT_EXPORT_DEF( void )
      FTC_Family_Init( FTC_Family  family,
                       FTC_Cache   cache )
      {
        FTC_GCacheClass  clazz = FTC_CACHE__GCACHE_CLASS( cache );
    
    
        family->clazz     = clazz->family_class;
        family->num_nodes = 0;
        family->cache     = cache;
      }
    
    
      FT_EXPORT_DEF( FT_Error )
      FTC_GCache_Init( FTC_GCache  cache )
      {
        FT_Error error;
    
        error = FTC_Cache_Init( FTC_CACHE( cache ) );
        if ( !error )
        {
          FTC_GCacheClass   clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class;
    
          FTC_MruList_Init( &cache->families,
                            clazz->family_class,
                            0,  /* no maximum here! */
                            cache,
                            FTC_CACHE( cache )->memory );
        }
    
        return error;
      }
    
    
      FT_LOCAL_DEF( FT_Error )
      ftc_gcache_init( FTC_Cache  ftccache )
      {
        FTC_GCache  cache = (FTC_GCache)ftccache;
    
    
        return FTC_GCache_Init( cache );
      }
    
    
      FT_EXPORT_DEF( void )
      FTC_GCache_Done( FTC_GCache  cache )
      {
        FTC_Cache_Done( (FTC_Cache)cache );
        FTC_MruList_Done( &cache->families );
      }
    
    
      FT_LOCAL_DEF( void )
      ftc_gcache_done( FTC_Cache  ftccache )
      {
        FTC_GCache  cache = (FTC_GCache)ftccache;
    
    
        FTC_GCache_Done( cache );
      }
    
    
      FT_EXPORT_DEF( FT_Error )
      FTC_GCache_New( FTC_Manager       manager,
                      FTC_GCacheClass   clazz,
                      FTC_GCache       *acache )
      {
        return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,
                                          (FTC_Cache*)acache );
      }
    
    
      FT_EXPORT_DEF( FT_Error )
      FTC_GCache_Lookup( FTC_GCache   cache,
                         FT_UInt32    hash,
                         FT_UInt      gindex,
                         FTC_GQuery   query,
                         FTC_Node    *anode )
      {
        FT_Error  error;
    
    
        query->gindex = gindex;
    
        FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );
        if ( !error )
          error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode );
    
        return error;
      }
    
    
    /* END */