Edit

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

Branch :

  • Show log

    Commit

  • Author : Werner Lemberg
    Date : 2015-03-01 19:27:09
    Hash : 851e8151
    Message : Various compiler warning fixes for `make multi'. * src/autofit/afcjk.c (af_cjk_hints_compute_blue_edges), src/autofit/aflatin.c (af_latin_hint_compute_blue_edges, af_latin_hint_edges), src/autofit/aflatin2.c (af_latin2_hints_compute_blue_edges, af_latin2_hint_edges): Declare as `static'. * src/cache/ftccmap.c (FTC_CMAP_QUERY_HASH, FTC_CMAP_NODE_HASH): Removed. Unused. * src/cache/ftcimage.c: Include FT_INTERNAL_OBJECTS_H. * src/cache/ftcmanag.c (FTC_LRU_GET_MANAGER): Removed. Unused. * src/cff/cf2intrp.c: Include `cf2intrp.h'. * src/cff/cffdrivr.c (PAIR_TAG): Removed. Unused. * src/gzip/ftgzip.c (NO_DUMMY_DECL): Removed. Unused. * src/psaux/afmparse.c (afm_parser_read_int): Declare as `static'. * src/pshinter/pshalgo.c (STRONGER, PSH_ZONE_MIN, PSH_ZONE_MAX): Removed. Unused. * src/raster/ftraster.c (Render_Glyph): Declare as `static'. * src/sfnt/ttpost.c (load_format_20): Fix signedness warning. * src/truetype/ttdriver.c (PAIR_TAG): Removed. Unused. * src/truetype/ttsubpix.c (is_member_of_family_class, is_member_of_style_class): Declare as `static'. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Declare as `static'. * src/type1/t1load.c (mm_axis_unmap, mm_weights_unmap): Declare as `static'. (T1_FIELD_COUNT): Removed. Unused. * src/type1/t1parse.h (T1_Done_Table): Removed. Unused. * src/type42/t42parse.c (T1_Done_Table): Removed. Unused.

  • src/cache/ftcimage.c
  • /***************************************************************************/
    /*                                                                         */
    /*  ftcimage.c                                                             */
    /*                                                                         */
    /*    FreeType Image cache (body).                                         */
    /*                                                                         */
    /*  Copyright 2000-2015 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 "ftcimage.h"
    #include FT_INTERNAL_MEMORY_H
    #include FT_INTERNAL_OBJECTS_H
    
    #include "ftccback.h"
    #include "ftcerror.h"
    
    
      /* finalize a given glyph image node */
      FT_LOCAL_DEF( void )
      ftc_inode_free( FTC_Node   ftcinode,
                      FTC_Cache  cache )
      {
        FTC_INode  inode = (FTC_INode)ftcinode;
        FT_Memory  memory = cache->memory;
    
    
        if ( inode->glyph )
        {
          FT_Done_Glyph( inode->glyph );
          inode->glyph = NULL;
        }
    
        FTC_GNode_Done( FTC_GNODE( inode ), cache );
        FT_FREE( inode );
      }
    
    
      FT_LOCAL_DEF( void )
      FTC_INode_Free( FTC_INode  inode,
                      FTC_Cache  cache )
      {
        ftc_inode_free( FTC_NODE( inode ), cache );
      }
    
    
      /* initialize a new glyph image node */
      FT_LOCAL_DEF( FT_Error )
      FTC_INode_New( FTC_INode   *pinode,
                     FTC_GQuery   gquery,
                     FTC_Cache    cache )
      {
        FT_Memory  memory = cache->memory;
        FT_Error   error;
        FTC_INode  inode  = NULL;
    
    
        if ( !FT_NEW( inode ) )
        {
          FTC_GNode         gnode  = FTC_GNODE( inode );
          FTC_Family        family = gquery->family;
          FT_UInt           gindex = gquery->gindex;
          FTC_IFamilyClass  clazz  = FTC_CACHE__IFAMILY_CLASS( cache );
    
    
          /* initialize its inner fields */
          FTC_GNode_Init( gnode, gindex, family );
    
          /* we will now load the glyph image */
          error = clazz->family_load_glyph( family, gindex, cache,
                                            &inode->glyph );
          if ( error )
          {
            FTC_INode_Free( inode, cache );
            inode = NULL;
          }
        }
    
        *pinode = inode;
        return error;
      }
    
    
      FT_LOCAL_DEF( FT_Error )
      ftc_inode_new( FTC_Node   *ftcpinode,
                     FT_Pointer  ftcgquery,
                     FTC_Cache   cache )
      {
        FTC_INode  *pinode = (FTC_INode*)ftcpinode;
        FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;
    
    
        return FTC_INode_New( pinode, gquery, cache );
      }
    
    
      FT_LOCAL_DEF( FT_Offset )
      ftc_inode_weight( FTC_Node   ftcinode,
                        FTC_Cache  ftccache )
      {
        FTC_INode  inode = (FTC_INode)ftcinode;
        FT_Offset  size  = 0;
        FT_Glyph   glyph = inode->glyph;
    
        FT_UNUSED( ftccache );
    
    
        switch ( glyph->format )
        {
        case FT_GLYPH_FORMAT_BITMAP:
          {
            FT_BitmapGlyph  bitg;
    
    
            bitg = (FT_BitmapGlyph)glyph;
            size = bitg->bitmap.rows * (FT_Offset)FT_ABS( bitg->bitmap.pitch ) +
                   sizeof ( *bitg );
          }
          break;
    
        case FT_GLYPH_FORMAT_OUTLINE:
          {
            FT_OutlineGlyph  outg;
    
    
            outg = (FT_OutlineGlyph)glyph;
            size = (FT_Offset)outg->outline.n_points *
                     ( sizeof ( FT_Vector ) + sizeof ( FT_Byte ) ) +
                   (FT_Offset)outg->outline.n_contours * sizeof ( FT_Short ) +
                   sizeof ( *outg );
          }
          break;
    
        default:
          ;
        }
    
        size += sizeof ( *inode );
        return size;
      }
    
    
    #if 0
    
      FT_LOCAL_DEF( FT_Offset )
      FTC_INode_Weight( FTC_INode  inode )
      {
        return ftc_inode_weight( FTC_NODE( inode ), NULL );
      }
    
    #endif /* 0 */
    
    
    /* END */