ReactOS  0.4.15-dev-499-g1f31905
ftcbasic.c File Reference
#include <ft2build.h>
#include "ftcglyph.h"
#include "ftcimage.h"
#include "ftcsbits.h"
#include "ftccback.h"
#include "ftcerror.h"
Include dependency graph for ftcbasic.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FTC_BasicAttrRec_
 
struct  FTC_BasicQueryRec_
 
struct  FTC_BasicFamilyRec_
 

Macros

#define FT_COMPONENT   trace_cache
 
#define FTC_BASIC_ATTR_COMPARE(a, b)
 
#define FTC_BASIC_ATTR_HASH(a)   ( FTC_SCALER_HASH( &(a)->scaler ) + 31 * (a)->load_flags )
 

Typedefs

typedef struct FTC_BasicAttrRec_ FTC_BasicAttrRec
 
typedef struct FTC_BasicAttrRec_FTC_BasicAttrs
 
typedef struct FTC_BasicQueryRec_ FTC_BasicQueryRec
 
typedef struct FTC_BasicQueryRec_FTC_BasicQuery
 
typedef struct FTC_BasicFamilyRec_ FTC_BasicFamilyRec
 
typedef struct FTC_BasicFamilyRec_FTC_BasicFamily
 

Functions

 ftc_basic_family_compare (FTC_MruNode ftcfamily, FT_Pointer ftcquery)
 
 ftc_basic_family_init (FTC_MruNode ftcfamily, FT_Pointer ftcquery, FT_Pointer ftccache)
 
 ftc_basic_family_get_count (FTC_Family ftcfamily, FTC_Manager manager)
 
 ftc_basic_family_load_bitmap (FTC_Family ftcfamily, FT_UInt gindex, FTC_Manager manager, FT_Face *aface)
 
 ftc_basic_family_load_glyph (FTC_Family ftcfamily, FT_UInt gindex, FTC_Cache cache, FT_Glyph *aglyph)
 
 ftc_basic_gnode_compare_faceid (FTC_Node ftcgnode, FT_Pointer ftcface_id, FTC_Cache cache, FT_Bool *list_changed)
 
 FTC_ImageCache_New (FTC_Manager manager, FTC_ImageCache *acache)
 
 FTC_ImageCache_Lookup (FTC_ImageCache cache, FTC_ImageType type, FT_UInt gindex, FT_Glyph *aglyph, FTC_Node *anode)
 
 FTC_ImageCache_LookupScaler (FTC_ImageCache cache, FTC_Scaler scaler, FT_ULong load_flags, FT_UInt gindex, FT_Glyph *aglyph, FTC_Node *anode)
 
 FTC_SBitCache_New (FTC_Manager manager, FTC_SBitCache *acache)
 
 FTC_SBitCache_Lookup (FTC_SBitCache cache, FTC_ImageType type, FT_UInt gindex, FTC_SBit *ansbit, FTC_Node *anode)
 
 FTC_SBitCache_LookupScaler (FTC_SBitCache cache, FTC_Scaler scaler, FT_ULong load_flags, FT_UInt gindex, FTC_SBit *ansbit, FTC_Node *anode)
 

Variables

static const FTC_IFamilyClassRec ftc_basic_image_family_class
 
static const FTC_GCacheClassRec ftc_basic_image_cache_class
 
static const FTC_SFamilyClassRec ftc_basic_sbit_family_class
 
static const FTC_GCacheClassRec ftc_basic_sbit_cache_class
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_cache

Definition at line 30 of file ftcbasic.c.

◆ FTC_BASIC_ATTR_COMPARE

#define FTC_BASIC_ATTR_COMPARE (   a,
  b 
)
Value:
FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \
(a)->load_flags == (b)->load_flags )
#define FTC_SCALER_COMPARE(a, b)
Definition: ftcmanag.h:154
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define FT_BOOL(x)
Definition: fttypes.h:578
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Definition at line 44 of file ftcbasic.c.

◆ FTC_BASIC_ATTR_HASH

#define FTC_BASIC_ATTR_HASH (   a)    ( FTC_SCALER_HASH( &(a)->scaler ) + 31 * (a)->load_flags )

Definition at line 48 of file ftcbasic.c.

Typedef Documentation

◆ FTC_BasicAttrRec

◆ FTC_BasicAttrs

◆ FTC_BasicFamily

◆ FTC_BasicFamilyRec

◆ FTC_BasicQuery

◆ FTC_BasicQueryRec

Function Documentation

◆ ftc_basic_family_compare()

ftc_basic_family_compare ( FTC_MruNode  ftcfamily,
FT_Pointer  ftcquery 
)

Definition at line 69 of file ftcbasic.c.

71  {
72  FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily;
74 
75 
76  return FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs );
77  }
struct FTC_BasicFamilyRec_ * FTC_BasicFamily
#define FTC_BASIC_ATTR_COMPARE(a, b)
Definition: ftcbasic.c:44
struct FTC_BasicQueryRec_ * FTC_BasicQuery
FTC_BasicAttrRec attrs
Definition: ftcbasic.c:63

Referenced by FTC_ImageCache_Lookup(), FTC_ImageCache_LookupScaler(), FTC_SBitCache_Lookup(), and FTC_SBitCache_LookupScaler().

◆ ftc_basic_family_get_count()

ftc_basic_family_get_count ( FTC_Family  ftcfamily,
FTC_Manager  manager 
)

Definition at line 97 of file ftcbasic.c.

99  {
100  FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily;
101  FT_Error error;
102  FT_Face face;
103  FT_UInt result = 0;
104 
105 
106  error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
107  &face );
108 
109  if ( error || !face )
110  return result;
111 
112  if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
113  FT_TRACE1(( "ftc_basic_family_get_count:"
114  " too large number of glyphs in this face, truncated\n",
115  face->num_glyphs ));
116 
117  if ( !error )
118  result = (FT_UInt)face->num_glyphs;
119 
120  return result;
121  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define error(str)
Definition: mkdosfs.c:1605
struct FTC_BasicFamilyRec_ * FTC_BasicFamily
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
WORD face[3]
Definition: mesh.c:4747
unsigned int FT_UInt
Definition: fttypes.h:231
FTC_ScalerRec scaler
Definition: ftcbasic.c:39
FTC_FaceID face_id
Definition: ftcache.h:427
FTC_BasicAttrRec attrs
Definition: ftcbasic.c:63
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
FTC_Manager_LookupFace(FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
Definition: ftcmanag.c:310

◆ ftc_basic_family_init()

ftc_basic_family_init ( FTC_MruNode  ftcfamily,
FT_Pointer  ftcquery,
FT_Pointer  ftccache 
)

Definition at line 81 of file ftcbasic.c.

84  {
85  FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily;
87  FTC_Cache cache = (FTC_Cache)ftccache;
88 
89 
90  FTC_Family_Init( FTC_FAMILY( family ), cache );
91  family->attrs = query->attrs;
92  return 0;
93  }
Definition: cache.c:48
struct FTC_BasicFamilyRec_ * FTC_BasicFamily
#define FTC_FAMILY(x)
Definition: ftcglyph.h:144
FTC_Family_Init(FTC_Family family, FTC_Cache cache)
Definition: ftcglyph.c:106
struct FTC_CacheRec_ * FTC_Cache
Definition: ftccache.h:31
struct FTC_BasicQueryRec_ * FTC_BasicQuery
FTC_BasicAttrRec attrs
Definition: ftcbasic.c:63

◆ ftc_basic_family_load_bitmap()

ftc_basic_family_load_bitmap ( FTC_Family  ftcfamily,
FT_UInt  gindex,
FTC_Manager  manager,
FT_Face aface 
)

Definition at line 125 of file ftcbasic.c.

129  {
130  FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily;
131  FT_Error error;
132  FT_Size size;
133 
134 
135  error = FTC_Manager_LookupSize( manager, &family->attrs.scaler, &size );
136  if ( !error )
137  {
138  FT_Face face = size->face;
139 
140 
142  face,
143  gindex,
144  (FT_Int)family->attrs.load_flags | FT_LOAD_RENDER );
145  if ( !error )
146  *aface = face;
147  }
148 
149  return error;
150  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
struct FTC_BasicFamilyRec_ * FTC_BasicFamily
#define FT_LOAD_RENDER
Definition: freetype.h:3011
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
GLsizeiptr size
Definition: glext.h:5919
WORD face[3]
Definition: mesh.c:4747
FTC_ScalerRec scaler
Definition: ftcbasic.c:39
FT_UInt load_flags
Definition: ftcbasic.c:40
FTC_Manager_LookupSize(FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
Definition: ftcmanag.c:183
FTC_BasicAttrRec attrs
Definition: ftcbasic.c:63
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ ftc_basic_family_load_glyph()

ftc_basic_family_load_glyph ( FTC_Family  ftcfamily,
FT_UInt  gindex,
FTC_Cache  cache,
FT_Glyph aglyph 
)

Definition at line 154 of file ftcbasic.c.

158  {
159  FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily;
160  FT_Error error;
161  FTC_Scaler scaler = &family->attrs.scaler;
162  FT_Face face;
163  FT_Size size;
164 
165 
166  /* we will now load the glyph image */
167  error = FTC_Manager_LookupSize( cache->manager,
168  scaler,
169  &size );
170  if ( !error )
171  {
172  face = size->face;
173 
175  gindex,
176  (FT_Int)family->attrs.load_flags );
177  if ( !error )
178  {
179  if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP ||
180  face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )
181  {
182  /* ok, copy it */
183  FT_Glyph glyph;
184 
185 
186  error = FT_Get_Glyph( face->glyph, &glyph );
187  if ( !error )
188  {
189  *aglyph = glyph;
190  goto Exit;
191  }
192  }
193  else
194  error = FT_THROW( Invalid_Argument );
195  }
196  }
197 
198  Exit:
199  return error;
200  }
Definition: cache.c:48
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
struct FTC_BasicFamilyRec_ * FTC_BasicFamily
#define FT_THROW(e)
Definition: ftdebug.h:213
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
GLsizeiptr size
Definition: glext.h:5919
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
WORD face[3]
Definition: mesh.c:4747
FT_Get_Glyph(FT_GlyphSlot slot, FT_Glyph *aglyph)
Definition: ftglyph.c:363
FTC_ScalerRec scaler
Definition: ftcbasic.c:39
FT_UInt load_flags
Definition: ftcbasic.c:40
FTC_Manager_LookupSize(FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
Definition: ftcmanag.c:183
FTC_BasicAttrRec attrs
Definition: ftcbasic.c:63
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ ftc_basic_gnode_compare_faceid()

ftc_basic_gnode_compare_faceid ( FTC_Node  ftcgnode,
FT_Pointer  ftcface_id,
FTC_Cache  cache,
FT_Bool list_changed 
)

Definition at line 204 of file ftcbasic.c.

208  {
209  FTC_GNode gnode = (FTC_GNode)ftcgnode;
210  FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
211  FTC_BasicFamily family = (FTC_BasicFamily)gnode->family;
212  FT_Bool result;
213 
214 
215  if ( list_changed )
216  *list_changed = FALSE;
217  result = FT_BOOL( family->attrs.scaler.face_id == face_id );
218  if ( result )
219  {
220  /* we must call this function to avoid this node from appearing
221  * in later lookups with the same face_id!
222  */
224  }
225  return result;
226  }
Definition: cache.c:48
FTC_GNode_UnselectFamily(FTC_GNode gnode, FTC_Cache cache)
Definition: ftcglyph.c:42
struct FTC_BasicFamilyRec_ * FTC_BasicFamily
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
Definition: ftcache.h:171
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
FTC_Family family
Definition: ftcglyph.h:151
struct FTC_GNodeRec_ * FTC_GNode
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define FT_BOOL(x)
Definition: fttypes.h:578
FTC_ScalerRec scaler
Definition: ftcbasic.c:39
FTC_FaceID face_id
Definition: ftcache.h:427
FTC_BasicAttrRec attrs
Definition: ftcbasic.c:63
GLuint64EXT * result
Definition: glext.h:11304

◆ FTC_ImageCache_Lookup()

FTC_ImageCache_Lookup ( FTC_ImageCache  cache,
FTC_ImageType  type,
FT_UInt  gindex,
FT_Glyph aglyph,
FTC_Node anode 
)

Definition at line 284 of file ftcbasic.c.

289  {
291  FTC_Node node = 0; /* make compiler happy */
292  FT_Error error;
293  FT_Offset hash;
294 
295 
296  /* some argument checks are delayed to `FTC_Cache_Lookup' */
297  if ( !aglyph )
298  {
299  error = FT_THROW( Invalid_Argument );
300  goto Exit;
301  }
302 
303  *aglyph = NULL;
304  if ( anode )
305  *anode = NULL;
306 
307  /*
308  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
309  * but public `FT_ImageType->flags' is of type `FT_Int32'.
310  *
311  * On 16bit systems, higher bits of type->flags cannot be handled.
312  */
313 #if 0xFFFFFFFFUL > FT_UINT_MAX
314  if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
315  FT_TRACE1(( "FTC_ImageCache_Lookup:"
316  " higher bits in load_flags 0x%x are dropped\n",
317  (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
318 #endif
319 
320  query.attrs.scaler.face_id = type->face_id;
321  query.attrs.scaler.width = type->width;
322  query.attrs.scaler.height = type->height;
323  query.attrs.load_flags = (FT_UInt)type->flags;
324 
325  query.attrs.scaler.pixel = 1;
326  query.attrs.scaler.x_res = 0; /* make compilers happy */
327  query.attrs.scaler.y_res = 0;
328 
329  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
330 
331 #if 1 /* inlining is about 50% faster! */
335  hash, gindex,
336  &query,
337  node,
338  error );
339 #else
340  error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
341  hash, gindex,
342  FTC_GQUERY( &query ),
343  &node );
344 #endif
345  if ( !error )
346  {
347  *aglyph = FTC_INODE( node )->glyph;
348 
349  if ( anode )
350  {
351  *anode = node;
352  node->ref_count++;
353  }
354  }
355 
356  Exit:
357  return error;
358  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:48
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define FTC_GQUERY(x)
Definition: ftcglyph.h:167
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
FTC_GNode_Compare(FTC_GNode gnode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcglyph.c:86
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_INODE(x)
Definition: ftcimage.h:54
#define FTC_GCACHE(x)
Definition: ftcglyph.h:219
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_ImageCache_LookupScaler()

FTC_ImageCache_LookupScaler ( FTC_ImageCache  cache,
FTC_Scaler  scaler,
FT_ULong  load_flags,
FT_UInt  gindex,
FT_Glyph aglyph,
FTC_Node anode 
)

Definition at line 364 of file ftcbasic.c.

370  {
372  FTC_Node node = 0; /* make compiler happy */
373  FT_Error error;
374  FT_Offset hash;
375 
376 
377  /* some argument checks are delayed to `FTC_Cache_Lookup' */
378  if ( !aglyph || !scaler )
379  {
380  error = FT_THROW( Invalid_Argument );
381  goto Exit;
382  }
383 
384  *aglyph = NULL;
385  if ( anode )
386  *anode = NULL;
387 
388  /*
389  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
390  * but public `FT_Face->face_flags' is of type `FT_Long'.
391  *
392  * On long > int systems, higher bits of load_flags cannot be handled.
393  */
394 #if FT_ULONG_MAX > FT_UINT_MAX
395  if ( load_flags > FT_UINT_MAX )
396  FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
397  " higher bits in load_flags 0x%x are dropped\n",
398  load_flags & ~((FT_ULong)FT_UINT_MAX) ));
399 #endif
400 
401  query.attrs.scaler = scaler[0];
402  query.attrs.load_flags = (FT_UInt)load_flags;
403 
404  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
405 
409  hash, gindex,
410  &query,
411  node,
412  error );
413  if ( !error )
414  {
415  *aglyph = FTC_INODE( node )->glyph;
416 
417  if ( anode )
418  {
419  *anode = node;
420  node->ref_count++;
421  }
422  }
423 
424  Exit:
425  return error;
426  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:48
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define error(str)
Definition: mkdosfs.c:1605
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
FTC_GNode_Compare(FTC_GNode gnode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcglyph.c:86
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_INODE(x)
Definition: ftcimage.h:54
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_ImageCache_New()

FTC_ImageCache_New ( FTC_Manager  manager,
FTC_ImageCache acache 
)

Definition at line 273 of file ftcbasic.c.

275  {
277  (FTC_GCache*)acache );
278  }
static const FTC_GCacheClassRec ftc_basic_image_cache_class
Definition: ftcbasic.c:252
FTC_GCache_New(FTC_Manager manager, FTC_GCacheClass clazz, FTC_GCache *acache)
Definition: ftcglyph.c:175

◆ FTC_SBitCache_Lookup()

FTC_SBitCache_Lookup ( FTC_SBitCache  cache,
FTC_ImageType  type,
FT_UInt  gindex,
FTC_SBit ansbit,
FTC_Node anode 
)

Definition at line 484 of file ftcbasic.c.

489  {
490  FT_Error error;
492  FTC_Node node = 0; /* make compiler happy */
493  FT_Offset hash;
494 
495 
496  if ( anode )
497  *anode = NULL;
498 
499  /* other argument checks delayed to `FTC_Cache_Lookup' */
500  if ( !ansbit )
501  return FT_THROW( Invalid_Argument );
502 
503  *ansbit = NULL;
504 
505  /*
506  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
507  * but public `FT_ImageType->flags' is of type `FT_Int32'.
508  *
509  * On 16bit systems, higher bits of type->flags cannot be handled.
510  */
511 #if 0xFFFFFFFFUL > FT_UINT_MAX
512  if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
513  FT_TRACE1(( "FTC_ImageCache_Lookup:"
514  " higher bits in load_flags 0x%x are dropped\n",
515  (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
516 #endif
517 
518  query.attrs.scaler.face_id = type->face_id;
519  query.attrs.scaler.width = type->width;
520  query.attrs.scaler.height = type->height;
521  query.attrs.load_flags = (FT_UInt)type->flags;
522 
523  query.attrs.scaler.pixel = 1;
524  query.attrs.scaler.x_res = 0; /* make compilers happy */
525  query.attrs.scaler.y_res = 0;
526 
527  /* beware, the hash must be the same for all glyph ranges! */
528  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
529  gindex / FTC_SBIT_ITEMS_PER_NODE;
530 
531 #if 1 /* inlining is about 50% faster! */
535  hash, gindex,
536  &query,
537  node,
538  error );
539 #else
540  error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
541  hash,
542  gindex,
543  FTC_GQUERY( &query ),
544  &node );
545 #endif
546  if ( error )
547  goto Exit;
548 
549  *ansbit = FTC_SNODE( node )->sbits +
550  ( gindex - FTC_GNODE( node )->gindex );
551 
552  if ( anode )
553  {
554  *anode = node;
555  node->ref_count++;
556  }
557 
558  Exit:
559  return error;
560  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:48
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define FTC_GQUERY(x)
Definition: ftcglyph.h:167
#define FTC_SBIT_ITEMS_PER_NODE
Definition: ftcsbits.h:30
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
#define FTC_GNODE(x)
Definition: ftcglyph.h:156
FTC_SNode_Compare(FTC_SNode snode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcsbits.c:412
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_SNODE(x)
Definition: ftcsbits.h:41
#define FTC_GCACHE(x)
Definition: ftcglyph.h:219
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_SBitCache_LookupScaler()

FTC_SBitCache_LookupScaler ( FTC_SBitCache  cache,
FTC_Scaler  scaler,
FT_ULong  load_flags,
FT_UInt  gindex,
FTC_SBit ansbit,
FTC_Node anode 
)

Definition at line 566 of file ftcbasic.c.

572  {
573  FT_Error error;
575  FTC_Node node = 0; /* make compiler happy */
576  FT_Offset hash;
577 
578 
579  if ( anode )
580  *anode = NULL;
581 
582  /* other argument checks delayed to `FTC_Cache_Lookup' */
583  if ( !ansbit || !scaler )
584  return FT_THROW( Invalid_Argument );
585 
586  *ansbit = NULL;
587 
588  /*
589  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
590  * but public `FT_Face->face_flags' is of type `FT_Long'.
591  *
592  * On long > int systems, higher bits of load_flags cannot be handled.
593  */
594 #if FT_ULONG_MAX > FT_UINT_MAX
595  if ( load_flags > FT_UINT_MAX )
596  FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
597  " higher bits in load_flags 0x%x are dropped\n",
598  load_flags & ~((FT_ULong)FT_UINT_MAX) ));
599 #endif
600 
601  query.attrs.scaler = scaler[0];
602  query.attrs.load_flags = (FT_UInt)load_flags;
603 
604  /* beware, the hash must be the same for all glyph ranges! */
605  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
606  gindex / FTC_SBIT_ITEMS_PER_NODE;
607 
611  hash, gindex,
612  &query,
613  node,
614  error );
615  if ( error )
616  goto Exit;
617 
618  *ansbit = FTC_SNODE( node )->sbits +
619  ( gindex - FTC_GNODE( node )->gindex );
620 
621  if ( anode )
622  {
623  *anode = node;
624  node->ref_count++;
625  }
626 
627  Exit:
628  return error;
629  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:48
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define FTC_SBIT_ITEMS_PER_NODE
Definition: ftcsbits.h:30
#define error(str)
Definition: mkdosfs.c:1605
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
#define FTC_GNODE(x)
Definition: ftcglyph.h:156
FTC_SNode_Compare(FTC_SNode snode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcsbits.c:412
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_SNODE(x)
Definition: ftcsbits.h:41
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_SBitCache_New()

FTC_SBitCache_New ( FTC_Manager  manager,
FTC_SBitCache acache 
)

Definition at line 473 of file ftcbasic.c.

475  {
476  return FTC_GCache_New( manager, &ftc_basic_sbit_cache_class,
477  (FTC_GCache*)acache );
478  }
static const FTC_GCacheClassRec ftc_basic_sbit_cache_class
Definition: ftcbasic.c:452
FTC_GCache_New(FTC_Manager manager, FTC_GCacheClass clazz, FTC_GCache *acache)
Definition: ftcglyph.c:175

Variable Documentation

◆ ftc_basic_image_cache_class

const FTC_GCacheClassRec ftc_basic_image_cache_class
static
Initial value:
=
{
{
sizeof ( FTC_GCacheRec ),
},
}
ftc_gnode_compare(FTC_Node gnode, FT_Pointer gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcglyph.c:66
struct FTC_GCacheRec_ FTC_GCacheRec
ftc_inode_free(FTC_Node inode, FTC_Cache cache)
Definition: ftcimage.c:31
static const FTC_IFamilyClassRec ftc_basic_image_family_class
Definition: ftcbasic.c:236
ftc_inode_weight(FTC_Node inode, FTC_Cache cache)
Definition: ftcimage.c:108
ftc_basic_gnode_compare_faceid(FTC_Node ftcgnode, FT_Pointer ftcface_id, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcbasic.c:204
ftc_inode_new(FTC_Node *pinode, FT_Pointer gquery, FTC_Cache cache)
Definition: ftcimage.c:95
ftc_gcache_done(FTC_Cache cache)
Definition: ftcglyph.c:153
ftc_gcache_init(FTC_Cache cache)
Definition: ftcglyph.c:119
struct FTC_MruListClassRec_ const * FTC_MruListClass
Definition: ftcmru.h:86

Definition at line 252 of file ftcbasic.c.

Referenced by FTC_ImageCache_New().

◆ ftc_basic_image_family_class

const FTC_IFamilyClassRec ftc_basic_image_family_class
static
Initial value:
=
{
{
sizeof ( FTC_BasicFamilyRec ),
NULL,
},
}
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
struct FTC_BasicFamilyRec_ FTC_BasicFamilyRec
ftc_basic_family_init(FTC_MruNode ftcfamily, FT_Pointer ftcquery, FT_Pointer ftccache)
Definition: ftcbasic.c:81
ftc_basic_family_load_glyph(FTC_Family ftcfamily, FT_UInt gindex, FTC_Cache cache, FT_Glyph *aglyph)
Definition: ftcbasic.c:154

Definition at line 236 of file ftcbasic.c.

◆ ftc_basic_sbit_cache_class

const FTC_GCacheClassRec ftc_basic_sbit_cache_class
static
Initial value:
=
{
{
sizeof ( FTC_GCacheRec ),
},
}
struct FTC_GCacheRec_ FTC_GCacheRec
ftc_snode_weight(FTC_Node snode, FTC_Cache cache)
Definition: ftcsbits.c:281
ftc_snode_compare(FTC_Node snode, FT_Pointer gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcsbits.c:327
ftc_snode_new(FTC_Node *psnode, FT_Pointer gquery, FTC_Cache cache)
Definition: ftcsbits.c:268
static const FTC_SFamilyClassRec ftc_basic_sbit_family_class
Definition: ftcbasic.c:436
ftc_basic_gnode_compare_faceid(FTC_Node ftcgnode, FT_Pointer ftcface_id, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcbasic.c:204
ftc_gcache_done(FTC_Cache cache)
Definition: ftcglyph.c:153
ftc_snode_free(FTC_Node snode, FTC_Cache cache)
Definition: ftcsbits.c:67
ftc_gcache_init(FTC_Cache cache)
Definition: ftcglyph.c:119
struct FTC_MruListClassRec_ const * FTC_MruListClass
Definition: ftcmru.h:86

Definition at line 452 of file ftcbasic.c.

Referenced by FTC_SBitCache_New().

◆ ftc_basic_sbit_family_class

const FTC_SFamilyClassRec ftc_basic_sbit_family_class
static
Initial value:
=
{
{
sizeof ( FTC_BasicFamilyRec ),
NULL,
},
}
ftc_basic_family_get_count(FTC_Family ftcfamily, FTC_Manager manager)
Definition: ftcbasic.c:97
ftc_basic_family_load_bitmap(FTC_Family ftcfamily, FT_UInt gindex, FTC_Manager manager, FT_Face *aface)
Definition: ftcbasic.c:125
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
struct FTC_BasicFamilyRec_ FTC_BasicFamilyRec
ftc_basic_family_init(FTC_MruNode ftcfamily, FT_Pointer ftcquery, FT_Pointer ftccache)
Definition: ftcbasic.c:81

Definition at line 436 of file ftcbasic.c.