ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ftcglyph.c
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftcglyph.c                                                             */
00004 /*                                                                         */
00005 /*    FreeType Glyph Image (FT_Glyph) cache (body).                        */
00006 /*                                                                         */
00007 /*  Copyright 2000-2001, 2003, 2004, 2006, 2009 by                         */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #include <ft2build.h>
00020 #include FT_CACHE_H
00021 #include "ftcglyph.h"
00022 #include FT_ERRORS_H
00023 
00024 #include "ftccback.h"
00025 #include "ftcerror.h"
00026 
00027 
00028   /* create a new chunk node, setting its cache index and ref count */
00029   FT_LOCAL_DEF( void )
00030   FTC_GNode_Init( FTC_GNode   gnode,
00031                   FT_UInt     gindex,
00032                   FTC_Family  family )
00033   {
00034     gnode->family = family;
00035     gnode->gindex = gindex;
00036     family->num_nodes++;
00037   }
00038 
00039 
00040   FT_LOCAL_DEF( void )
00041   FTC_GNode_UnselectFamily( FTC_GNode  gnode,
00042                             FTC_Cache  cache )
00043   {
00044     FTC_Family  family = gnode->family;
00045 
00046 
00047     gnode->family = NULL;
00048     if ( family && --family->num_nodes == 0 )
00049       FTC_FAMILY_FREE( family, cache );
00050   }
00051 
00052 
00053   FT_LOCAL_DEF( void )
00054   FTC_GNode_Done( FTC_GNode  gnode,
00055                   FTC_Cache  cache )
00056   {
00057     /* finalize the node */
00058     gnode->gindex = 0;
00059 
00060     FTC_GNode_UnselectFamily( gnode, cache );
00061   }
00062 
00063 
00064   FT_LOCAL_DEF( FT_Bool )
00065   ftc_gnode_compare( FTC_Node    ftcgnode,
00066                      FT_Pointer  ftcgquery,
00067                      FTC_Cache   cache )
00068   {
00069     FTC_GNode   gnode  = (FTC_GNode)ftcgnode;
00070     FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;
00071     FT_UNUSED( cache );
00072 
00073 
00074     return FT_BOOL( gnode->family == gquery->family &&
00075                     gnode->gindex == gquery->gindex );
00076   }
00077 
00078 
00079   FT_LOCAL_DEF( FT_Bool )
00080   FTC_GNode_Compare( FTC_GNode   gnode,
00081                      FTC_GQuery  gquery )
00082   {
00083     return ftc_gnode_compare( FTC_NODE( gnode ), gquery, NULL );
00084   }
00085 
00086 
00087   /*************************************************************************/
00088   /*************************************************************************/
00089   /*****                                                               *****/
00090   /*****                      CHUNK SETS                               *****/
00091   /*****                                                               *****/
00092   /*************************************************************************/
00093   /*************************************************************************/
00094 
00095   FT_LOCAL_DEF( void )
00096   FTC_Family_Init( FTC_Family  family,
00097                    FTC_Cache   cache )
00098   {
00099     FTC_GCacheClass  clazz = FTC_CACHE__GCACHE_CLASS( cache );
00100 
00101 
00102     family->clazz     = clazz->family_class;
00103     family->num_nodes = 0;
00104     family->cache     = cache;
00105   }
00106 
00107 
00108   FT_LOCAL_DEF( FT_Error )
00109   ftc_gcache_init( FTC_Cache  ftccache )
00110   {
00111     FTC_GCache  cache = (FTC_GCache)ftccache;
00112     FT_Error    error;
00113 
00114 
00115     error = FTC_Cache_Init( FTC_CACHE( cache ) );
00116     if ( !error )
00117     {
00118       FTC_GCacheClass   clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class;
00119 
00120       FTC_MruList_Init( &cache->families,
00121                         clazz->family_class,
00122                         0,  /* no maximum here! */
00123                         cache,
00124                         FTC_CACHE( cache )->memory );
00125     }
00126 
00127     return error;
00128   }
00129 
00130 
00131 #if 0
00132 
00133   FT_LOCAL_DEF( FT_Error )
00134   FTC_GCache_Init( FTC_GCache  cache )
00135   {
00136     return ftc_gcache_init( FTC_CACHE( cache ) );
00137   }
00138 
00139 #endif /* 0 */
00140 
00141 
00142   FT_LOCAL_DEF( void )
00143   ftc_gcache_done( FTC_Cache  ftccache )
00144   {
00145     FTC_GCache  cache = (FTC_GCache)ftccache;
00146 
00147 
00148     FTC_Cache_Done( (FTC_Cache)cache );
00149     FTC_MruList_Done( &cache->families );
00150   }
00151 
00152 
00153 #if 0
00154 
00155   FT_LOCAL_DEF( void )
00156   FTC_GCache_Done( FTC_GCache  cache )
00157   {
00158     ftc_gcache_done( FTC_CACHE( cache ) );
00159   }
00160 
00161 #endif /* 0 */
00162 
00163 
00164   FT_LOCAL_DEF( FT_Error )
00165   FTC_GCache_New( FTC_Manager       manager,
00166                   FTC_GCacheClass   clazz,
00167                   FTC_GCache       *acache )
00168   {
00169     return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,
00170                                       (FTC_Cache*)acache );
00171   }
00172 
00173 
00174 #ifndef FTC_INLINE
00175 
00176   FT_LOCAL_DEF( FT_Error )
00177   FTC_GCache_Lookup( FTC_GCache   cache,
00178                      FT_PtrDist   hash,
00179                      FT_UInt      gindex,
00180                      FTC_GQuery   query,
00181                      FTC_Node    *anode )
00182   {
00183     FT_Error  error;
00184 
00185 
00186     query->gindex = gindex;
00187 
00188     FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );
00189     if ( !error )
00190     {
00191       FTC_Family  family = query->family;
00192 
00193 
00194       /* prevent the family from being destroyed too early when an        */
00195       /* out-of-memory condition occurs during glyph node initialization. */
00196       family->num_nodes++;
00197 
00198       error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode );
00199 
00200       if ( --family->num_nodes == 0 )
00201         FTC_FAMILY_FREE( family, cache );
00202     }
00203     return error;
00204   }
00205 
00206 #endif /* !FTC_INLINE */
00207 
00208 
00209 /* END */

Generated on Sun May 27 2012 04:33:48 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.