PageRenderTime 294ms CodeModel.GetById 161ms app.highlight 6ms RepoModel.GetById 124ms app.codeStats 1ms

/src/compiler/android-ndk/jni/freetype/src/raster/ftmisc.h

http://ftk.googlecode.com/
C++ Header | 109 lines | 52 code | 29 blank | 28 comment | 3 complexity | 462642010e4240d9d9f09ce5bcbb9e6f MD5 | raw file
  1/***************************************************************************/
  2/*                                                                         */
  3/*  ftmisc.h                                                               */
  4/*                                                                         */
  5/*    Miscellaneous macros for stand-alone rasterizer (specification       */
  6/*    only).                                                               */
  7/*                                                                         */
  8/*  Copyright 2005, 2009 by                                                */
  9/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 10/*                                                                         */
 11/*  This file is part of the FreeType project, and may only be used        */
 12/*  modified and distributed under the terms of the FreeType project       */
 13/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
 14/*  this file you indicate that you have read the license and              */
 15/*  understand and accept it fully.                                        */
 16/*                                                                         */
 17/***************************************************************************/
 18
 19
 20  /***************************************************/
 21  /*                                                 */
 22  /* This file is *not* portable!  You have to adapt */
 23  /* its definitions to your platform.               */
 24  /*                                                 */
 25  /***************************************************/
 26
 27#ifndef __FTMISC_H__
 28#define __FTMISC_H__
 29
 30  /* memset */
 31#include FT_CONFIG_STANDARD_LIBRARY_H
 32
 33#define FT_BEGIN_HEADER
 34#define FT_END_HEADER
 35
 36#define FT_LOCAL_DEF( x )   static x
 37
 38  /* from include/freetype2/fttypes.h */
 39
 40  typedef unsigned char  FT_Byte;
 41  typedef signed int     FT_Int;
 42  typedef unsigned int   FT_UInt;
 43  typedef signed long    FT_Long;
 44  typedef unsigned long  FT_ULong;
 45  typedef signed long    FT_F26Dot6;
 46  typedef int            FT_Error;
 47
 48#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
 49          ( ( (FT_ULong)_x1 << 24 ) |     \
 50            ( (FT_ULong)_x2 << 16 ) |     \
 51            ( (FT_ULong)_x3 <<  8 ) |     \
 52              (FT_ULong)_x4         )
 53
 54
 55  /* from include/freetype2/ftsystem.h */
 56
 57  typedef struct FT_MemoryRec_*  FT_Memory;
 58
 59  typedef void* (*FT_Alloc_Func)( FT_Memory  memory,
 60                                  long       size );
 61
 62  typedef void (*FT_Free_Func)( FT_Memory  memory,
 63                                void*      block );
 64
 65  typedef void* (*FT_Realloc_Func)( FT_Memory  memory,
 66                                    long       cur_size,
 67                                    long       new_size,
 68                                    void*      block );
 69
 70  typedef struct FT_MemoryRec_
 71  {
 72    void*            user;
 73
 74    FT_Alloc_Func    alloc;
 75    FT_Free_Func     free;
 76    FT_Realloc_Func  realloc;
 77
 78  } FT_MemoryRec;
 79
 80  /* from src/ftcalc.c */
 81
 82#include <inttypes.h>
 83
 84  typedef int64_t  FT_Int64;
 85
 86  static FT_Long
 87  FT_MulDiv( FT_Long  a,
 88             FT_Long  b,
 89             FT_Long  c )
 90  {
 91    FT_Int   s;
 92    FT_Long  d;
 93
 94
 95    s = 1;
 96    if ( a < 0 ) { a = -a; s = -1; }
 97    if ( b < 0 ) { b = -b; s = -s; }
 98    if ( c < 0 ) { c = -c; s = -s; }
 99
100    d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
101                         : 0x7FFFFFFFL );
102
103    return ( s > 0 ) ? d : -d;
104  }
105
106#endif /* __FTMISC_H__ */
107
108
109/* END */