ReactOS 0.4.16-dev-2357-g35d0dfe
ftcmanag.h File Reference
#include <freetype/ftcache.h>
#include "ftcmru.h"
#include "ftccache.h"
Include dependency graph for ftcmanag.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FTC_ManagerRec_
 

Macros

#define FTC_MAX_FACES_DEFAULT   2
 
#define FTC_MAX_SIZES_DEFAULT   4
 
#define FTC_MAX_BYTES_DEFAULT   200000L /* ~200kByte by default */
 
#define FTC_MAX_CACHES   16
 
#define FTC_SCALER_COMPARE(a, b)
 
#define FTC_SCALER_HASH(q)
 

Typedefs

typedef struct FTC_ManagerRec_ FTC_ManagerRec
 

Functions

 FTC_Manager_Compress (FTC_Manager manager)
 
 FTC_Manager_FlushN (FTC_Manager manager, FT_UInt count)
 
 FTC_Manager_RegisterCache (FTC_Manager manager, FTC_CacheClass clazz, FTC_Cache *acache)
 

Macro Definition Documentation

◆ FTC_MAX_BYTES_DEFAULT

#define FTC_MAX_BYTES_DEFAULT   200000L /* ~200kByte by default */

Definition at line 84 of file ftcmanag.h.

◆ FTC_MAX_CACHES

#define FTC_MAX_CACHES   16

Definition at line 87 of file ftcmanag.h.

◆ FTC_MAX_FACES_DEFAULT

#define FTC_MAX_FACES_DEFAULT   2

Definition at line 82 of file ftcmanag.h.

◆ FTC_MAX_SIZES_DEFAULT

#define FTC_MAX_SIZES_DEFAULT   4

Definition at line 83 of file ftcmanag.h.

◆ FTC_SCALER_COMPARE

#define FTC_SCALER_COMPARE (   a,
  b 
)
Value:
( (a)->face_id == (b)->face_id && \
(a)->width == (b)->width && \
(a)->height == (b)->height && \
((a)->pixel != 0) == ((b)->pixel != 0) && \
( (a)->pixel || \
( (a)->x_res == (b)->x_res && \
(a)->y_res == (b)->y_res ) ) )
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79

Definition at line 154 of file ftcmanag.h.

◆ FTC_SCALER_HASH

#define FTC_SCALER_HASH (   q)
Value:
( FTC_FACE_ID_HASH( (q)->face_id ) + \
(q)->width + (q)->height*7 + \
( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) )
#define FTC_FACE_ID_HASH(i)
Definition: ftccache.h:27
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063

Definition at line 163 of file ftcmanag.h.

Typedef Documentation

◆ FTC_ManagerRec

Function Documentation

◆ FTC_Manager_Compress()

FTC_Manager_Compress ( FTC_Manager  manager)

Definition at line 533 of file ftcmanag.c.

534 {
536
537
538 if ( !manager )
539 return;
540
541 first = manager->nodes_list;
542
543#ifdef FT_DEBUG_ERROR
544 FTC_Manager_Check( manager );
545
546 FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
547 manager->cur_weight, manager->max_weight,
548 manager->num_nodes ));
549#endif
550
551 if ( manager->cur_weight < manager->max_weight || !first )
552 return;
553
554 /* go to last node -- it's a circular list */
556 do
557 {
558 FTC_Node prev;
559
560
561 prev = ( node == first ) ? NULL : FTC_NODE_PREV( node );
562
563 if ( node->ref_count <= 0 )
564 ftc_node_destroy( node, manager );
565
566 node = prev;
567
568 } while ( node && manager->cur_weight > manager->max_weight );
569 }
#define NULL
Definition: types.h:112
ftc_node_destroy(FTC_Node node, FTC_Manager manager)
Definition: ftccache.c:272
#define FTC_NODE_PREV(x)
Definition: ftccache.h:73
#define FT_TRACE0(varformat)
Definition: ftdebug.h:187
const GLint * first
Definition: glext.h:5794
FT_Offset cur_weight
Definition: ftcmanag.h:97
FT_Offset max_weight
Definition: ftcmanag.h:96
FTC_Node nodes_list
Definition: ftcmanag.h:95
FT_UInt num_nodes
Definition: ftcmanag.h:98
Definition: dlist.c:348

Referenced by ftc_cache_add().

◆ FTC_Manager_FlushN()

FTC_Manager_FlushN ( FTC_Manager  manager,
FT_UInt  count 
)

Definition at line 627 of file ftcmanag.c.

629 {
630 FTC_Node first = manager->nodes_list;
633
634
635 /* try to remove `count' nodes from the list */
636 if ( !first ) /* empty list! */
637 return 0;
638
639 /* go to last node - it's a circular list */
641 for ( result = 0; result < count; )
642 {
643 FTC_Node prev = FTC_NODE_PREV( node );
644
645
646 /* don't touch locked nodes */
647 if ( node->ref_count <= 0 )
648 {
649 ftc_node_destroy( node, manager );
650 result++;
651 }
652
653 if ( node == first )
654 break;
655
656 node = prev;
657 }
658 return result;
659 }
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint64EXT * result
Definition: glext.h:11304

Referenced by FTC_Manager_Reset().

◆ FTC_Manager_RegisterCache()

FTC_Manager_RegisterCache ( FTC_Manager  manager,
FTC_CacheClass  clazz,
FTC_Cache acache 
)

Definition at line 575 of file ftcmanag.c.

578 {
579 FT_Error error = FT_ERR( Invalid_Argument );
581
582
583 if ( manager && clazz && acache )
584 {
585 FT_Memory memory = manager->memory;
586
587
588 if ( manager->num_caches >= FTC_MAX_CACHES )
589 {
590 error = FT_THROW( Too_Many_Caches );
591 FT_ERROR(( "FTC_Manager_RegisterCache:"
592 " too many registered caches\n" ));
593 goto Exit;
594 }
595
596 if ( !FT_ALLOC( cache, clazz->cache_size ) )
597 {
598 cache->manager = manager;
599 cache->memory = memory;
600 cache->clazz = clazz[0];
601 cache->org_class = clazz;
602
603 /* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */
604 /* IF IT IS NOT SET CORRECTLY */
605 cache->index = manager->num_caches;
606
607 error = clazz->cache_init( cache );
608 if ( error )
609 {
610 clazz->cache_done( cache );
611 FT_FREE( cache );
612 goto Exit;
613 }
614
615 manager->caches[manager->num_caches++] = cache;
616 }
617 }
618
619 Exit:
620 if ( acache )
621 *acache = cache;
622 return error;
623 }
#define FTC_MAX_CACHES
Definition: ftcmanag.h:87
#define FT_ERROR(varformat)
Definition: ftdebug.h:211
#define FT_THROW(e)
Definition: ftdebug.h:243
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:311
#define FT_FREE(ptr)
Definition: ftmemory.h:337
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
int FT_Error
Definition: fttypes.h:299
#define FT_ERR(e)
Definition: fttypes.h:599
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:122
static void Exit(void)
Definition: sock.c:1330
FTC_Cache_DoneFunc cache_done
Definition: ftccache.h:137
FT_Offset cache_size
Definition: ftccache.h:135
FTC_Cache_InitFunc cache_init
Definition: ftccache.h:136
FT_UInt num_caches
Definition: ftcmanag.h:101
FTC_Cache caches[FTC_MAX_CACHES]
Definition: ftcmanag.h:100
FT_Memory memory
Definition: ftcmanag.h:93
Definition: cache.c:49

Referenced by FTC_CMapCache_New(), and FTC_GCache_New().