/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. /* This file is *not* portable! You have to adapt */
  21. /* its definitions to your platform. */
  22. /* */
  23. /***************************************************/
  24. #ifndef __FTMISC_H__
  25. #define __FTMISC_H__
  26. /* memset */
  27. #include FT_CONFIG_STANDARD_LIBRARY_H
  28. #define FT_BEGIN_HEADER
  29. #define FT_END_HEADER
  30. #define FT_LOCAL_DEF( x ) static x
  31. /* from include/freetype2/fttypes.h */
  32. typedef unsigned char FT_Byte;
  33. typedef signed int FT_Int;
  34. typedef unsigned int FT_UInt;
  35. typedef signed long FT_Long;
  36. typedef unsigned long FT_ULong;
  37. typedef signed long FT_F26Dot6;
  38. typedef int FT_Error;
  39. #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
  40. ( ( (FT_ULong)_x1 << 24 ) | \
  41. ( (FT_ULong)_x2 << 16 ) | \
  42. ( (FT_ULong)_x3 << 8 ) | \
  43. (FT_ULong)_x4 )
  44. /* from include/freetype2/ftsystem.h */
  45. typedef struct FT_MemoryRec_* FT_Memory;
  46. typedef void* (*FT_Alloc_Func)( FT_Memory memory,
  47. long size );
  48. typedef void (*FT_Free_Func)( FT_Memory memory,
  49. void* block );
  50. typedef void* (*FT_Realloc_Func)( FT_Memory memory,
  51. long cur_size,
  52. long new_size,
  53. void* block );
  54. typedef struct FT_MemoryRec_
  55. {
  56. void* user;
  57. FT_Alloc_Func alloc;
  58. FT_Free_Func free;
  59. FT_Realloc_Func realloc;
  60. } FT_MemoryRec;
  61. /* from src/ftcalc.c */
  62. #include <inttypes.h>
  63. typedef int64_t FT_Int64;
  64. static FT_Long
  65. FT_MulDiv( FT_Long a,
  66. FT_Long b,
  67. FT_Long c )
  68. {
  69. FT_Int s;
  70. FT_Long d;
  71. s = 1;
  72. if ( a < 0 ) { a = -a; s = -1; }
  73. if ( b < 0 ) { b = -b; s = -s; }
  74. if ( c < 0 ) { c = -c; s = -s; }
  75. d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
  76. : 0x7FFFFFFFL );
  77. return ( s > 0 ) ? d : -d;
  78. }
  79. #endif /* __FTMISC_H__ */
  80. /* END */