ftmisc.h

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftmisc.h                                                               */
00004 /*                                                                         */
00005 /*    Miscellaneous macros for stand-alone rasterizer (specification       */
00006 /*    only).                                                               */
00007 /*                                                                         */
00008 /*  Copyright 2005, 2009 by                                                */
00009 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00010 /*                                                                         */
00011 /*  This file is part of the FreeType project, and may only be used        */
00012 /*  modified and distributed under the terms of the FreeType project       */
00013 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00014 /*  this file you indicate that you have read the license and              */
00015 /*  understand and accept it fully.                                        */
00016 /*                                                                         */
00017 /***************************************************************************/
00018 
00019 
00020   /***************************************************/
00021   /*                                                 */
00022   /* This file is *not* portable!  You have to adapt */
00023   /* its definitions to your platform.               */
00024   /*                                                 */
00025   /***************************************************/
00026 
00027 #ifndef __FTMISC_H__
00028 #define __FTMISC_H__
00029 
00030   /* memset */
00031 #include FT_CONFIG_STANDARD_LIBRARY_H
00032 
00033 #define FT_BEGIN_HEADER
00034 #define FT_END_HEADER
00035 
00036 #define FT_LOCAL_DEF( x )   static x
00037 
00038   /* from include/freetype2/fttypes.h */
00039 
00040   typedef unsigned char  FT_Byte;
00041   typedef signed int     FT_Int;
00042   typedef unsigned int   FT_UInt;
00043   typedef signed long    FT_Long;
00044   typedef unsigned long  FT_ULong;
00045   typedef signed long    FT_F26Dot6;
00046   typedef int            FT_Error;
00047 
00048 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
00049           ( ( (FT_ULong)_x1 << 24 ) |     \
00050             ( (FT_ULong)_x2 << 16 ) |     \
00051             ( (FT_ULong)_x3 <<  8 ) |     \
00052               (FT_ULong)_x4         )
00053 
00054 
00055   /* from include/freetype2/ftsystem.h */
00056 
00057   typedef struct FT_MemoryRec_*  FT_Memory;
00058 
00059   typedef void* (*FT_Alloc_Func)( FT_Memory  memory,
00060                                   long       size );
00061 
00062   typedef void (*FT_Free_Func)( FT_Memory  memory,
00063                                 void*      block );
00064 
00065   typedef void* (*FT_Realloc_Func)( FT_Memory  memory,
00066                                     long       cur_size,
00067                                     long       new_size,
00068                                     void*      block );
00069 
00070   typedef struct FT_MemoryRec_
00071   {
00072     void*            user;
00073 
00074     FT_Alloc_Func    alloc;
00075     FT_Free_Func     free;
00076     FT_Realloc_Func  realloc;
00077 
00078   } FT_MemoryRec;
00079 
00080   /* from src/ftcalc.c */
00081 
00082 #include <inttypes.h>
00083 
00084   typedef int64_t  FT_Int64;
00085 
00086   static FT_Long
00087   FT_MulDiv( FT_Long  a,
00088              FT_Long  b,
00089              FT_Long  c )
00090   {
00091     FT_Int   s;
00092     FT_Long  d;
00093 
00094 
00095     s = 1;
00096     if ( a < 0 ) { a = -a; s = -1; }
00097     if ( b < 0 ) { b = -b; s = -s; }
00098     if ( c < 0 ) { c = -c; s = -s; }
00099 
00100     d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
00101                          : 0x7FFFFFFFL );
00102 
00103     return ( s > 0 ) ? d : -d;
00104   }
00105 
00106 #endif /* __FTMISC_H__ */
00107 
00108 
00109 /* END */

Generated on Tue Jul 5 14:13:50 2011 for ROOT_528-00b_version by  doxygen 1.5.1