Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*******************************************************************
  2.  *
  3.  *  ttengine.h                                                   1.1
  4.  *
  5.  *    Engine instance structure definition.
  6.  *
  7.  *  Copyright 1996-1999 by
  8.  *  David Turner, Robert Wilhelm, and Werner Lemberg.
  9.  *
  10.  *  This file is part of the FreeType project, and may only be used
  11.  *  modified and distributed under the terms of the FreeType project
  12.  *  license, LICENSE.TXT.  By continuing to use, modify, or distribute
  13.  *  this file you indicate that you have read the license and
  14.  *  understand and accept it fully.
  15.  *
  16.  *  New in 1.1 :
  17.  *
  18.  *    - added the 'raster_lock' mutex field to synchronize
  19.  *      scan-line conversion in thread-safe and re-entrant builds.
  20.  *
  21.  ******************************************************************/
  22.  
  23. #ifndef TTENGINE_H
  24. #define TTENGINE_H
  25.  
  26. #include "tttypes.h"
  27. #include "ttconfig.h"
  28. #include "freetype.h"
  29. #include "ttmutex.h"
  30.  
  31. #ifdef __cplusplus
  32.   extern "C" {
  33. #endif
  34.  
  35.   /********************************************************************/
  36.   /*                                                                  */
  37.   /*  The freetype engine instance structure.                         */
  38.   /*                                                                  */
  39.   /*  This structure holds all the data that is necessary to run      */
  40.   /*  one instance of the freetype engine.  It is needed to get a     */
  41.   /*  completely re-entrant version of the library.                   */
  42.   /*                                                                  */
  43.   /*  The goal is to move _all_ component-specific variables, either  */
  44.   /*  static or global in the structure; the component initializers   */
  45.   /*  and finalizers will all be called with the address of a valid   */
  46.   /*  TEngine_Instance.                                               */
  47.   /*                                                                  */
  48.   /********************************************************************/
  49.  
  50.   struct  TEngine_Instance_
  51.   {
  52.      TMutex  lock;               /* engine lock */
  53.  
  54.      void*   list_free_elements;
  55.  
  56.      void*   objs_face_class;       /* the face cache class     */
  57.      void*   objs_instance_class;   /* the instance cache class */
  58.      void*   objs_execution_class;  /* the context cache class  */
  59.      void*   objs_glyph_class;      /* the glyph cache class    */
  60.  
  61.      void*   objs_face_cache;  /* these caches are used to track */
  62.      void*   objs_exec_cache;  /* the current face and execution */
  63.                                /* context objects                */
  64.  
  65.      void*   file_component;    /* ttfile implementation dependent   */
  66.  
  67.      TMutex  raster_lock;       /* mutex for this engine's render pool   */
  68.      void*   raster_component;  /* ttraster implementation depedent      */
  69.      Byte    raster_palette[5]; /* gray-levels palette for anti-aliasing */
  70.  
  71.      void*   extension_component;  /* extensions dependent */
  72.  
  73. #if 0
  74.      TT_Glyph_Loader_Callback  glCallback; /* glyph loader callback, if any */
  75. #endif
  76.   };
  77.  
  78.   /* NOTE : The raster's lock is only acquired by the Render_Glyph and     */
  79.   /*        Render_Gray_Glyph functions, which always release it on exit   */
  80.   /*        They do not lock the engine mutex. This means you shouldn't    */
  81.   /*        be concerned about deadlocks between the two mutexes, as these */
  82.   /*        should never appear..                                          */
  83.  
  84.   typedef struct TEngine_Instance_  TEngine_Instance;
  85.   typedef TEngine_Instance*         PEngine_Instance;
  86.  
  87.  
  88. #ifdef TT_CONFIG_OPTION_THREAD_SAFE  /* for re-entrant builds */
  89.  
  90. #define ENGINE_ARG    TEngine_Instance*  _engine
  91. #define ENGINE_ARGS   TEngine_Instance*  _engine,
  92.  
  93. #define ENGINE_VAR   _engine
  94. #define ENGINE_VARS  _engine,
  95.  
  96. #define ENGINE  _engine
  97.  
  98. #else                       /* for thread-safe builds */
  99.  
  100. #define ENGINE_ARG    /* void */
  101. #define ENGINE_ARGS
  102.  
  103. #define ENGINE_VAR
  104. #define ENGINE_VARS
  105.  
  106. #endif /* TT_CONFIG_OPTION_THREAD_SAFE */
  107.  
  108. #ifdef __cplusplus
  109.   }
  110. #endif
  111.  
  112. #endif /* TTENGINE_H */
  113.  
  114.  
  115. /* END */
  116.