ReactOS 0.4.16-dev-306-g647d351
ftcmanag.h File Reference
#include <ft2build.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 85 of file ftcmanag.h.

◆ FTC_MAX_CACHES

#define FTC_MAX_CACHES   16

Definition at line 88 of file ftcmanag.h.

◆ FTC_MAX_FACES_DEFAULT

#define FTC_MAX_FACES_DEFAULT   2

Definition at line 83 of file ftcmanag.h.

◆ FTC_MAX_SIZES_DEFAULT

#define FTC_MAX_SIZES_DEFAULT   4

Definition at line 84 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 538 of file ftcmanag.c.

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

Referenced by ftc_cache_add().

◆ FTC_Manager_FlushN()

FTC_Manager_FlushN ( FTC_Manager  manager,
FT_UInt  count 
)

Definition at line 632 of file ftcmanag.c.

634 {
635 FTC_Node first = manager->nodes_list;
638
639
640 /* try to remove `count' nodes from the list */
641 if ( !first ) /* empty list! */
642 return 0;
643
644 /* go to last node - it's a circular list */
646 for ( result = 0; result < count; )
647 {
648 FTC_Node prev = FTC_NODE_PREV( node );
649
650
651 /* don't touch locked nodes */
652 if ( node->ref_count <= 0 )
653 {
654 ftc_node_destroy( node, manager );
655 result++;
656 }
657
658 if ( node == first )
659 break;
660
661 node = prev;
662 }
663 return result;
664 }
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 580 of file ftcmanag.c.

583 {
584 FT_Error error = FT_ERR( Invalid_Argument );
586
587
588 if ( manager && clazz && acache )
589 {
590 FT_Memory memory = manager->memory;
591
592
593 if ( manager->num_caches >= FTC_MAX_CACHES )
594 {
595 error = FT_THROW( Too_Many_Caches );
596 FT_ERROR(( "FTC_Manager_RegisterCache:"
597 " too many registered caches\n" ));
598 goto Exit;
599 }
600
601 if ( !FT_ALLOC( cache, clazz->cache_size ) )
602 {
603 cache->manager = manager;
604 cache->memory = memory;
605 cache->clazz = clazz[0];
606 cache->org_class = clazz;
607
608 /* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */
609 /* IF IT IS NOT SET CORRECTLY */
610 cache->index = manager->num_caches;
611
612 error = clazz->cache_init( cache );
613 if ( error )
614 {
615 clazz->cache_done( cache );
616 FT_FREE( cache );
617 goto Exit;
618 }
619
620 manager->caches[manager->num_caches++] = cache;
621 }
622 }
623
624 Exit:
625 if ( acache )
626 *acache = cache;
627 return error;
628 }
#define FTC_MAX_CACHES
Definition: ftcmanag.h:88
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
int FT_Error
Definition: fttypes.h:300
#define FT_ERR(e)
Definition: fttypes.h:586
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
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:102
FTC_Cache caches[FTC_MAX_CACHES]
Definition: ftcmanag.h:101
FT_Memory memory
Definition: ftcmanag.h:94
Definition: cache.c:49

Referenced by FTC_CMapCache_New(), and FTC_GCache_New().