ReactOS 0.4.16-dev-1019-g2c2cdfd
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 155 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 164 of file ftcmanag.h.

Typedef Documentation

◆ FTC_ManagerRec

Function Documentation

◆ FTC_Manager_Compress()

FTC_Manager_Compress ( FTC_Manager  manager)

Definition at line 534 of file ftcmanag.c.

535 {
537
538
539 if ( !manager )
540 return;
541
542 first = manager->nodes_list;
543
544#ifdef FT_DEBUG_ERROR
545 FTC_Manager_Check( manager );
546
547 FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
548 manager->cur_weight, manager->max_weight,
549 manager->num_nodes ));
550#endif
551
552 if ( manager->cur_weight < manager->max_weight || !first )
553 return;
554
555 /* go to last node -- it's a circular list */
557 do
558 {
559 FTC_Node prev;
560
561
562 prev = ( node == first ) ? NULL : FTC_NODE_PREV( node );
563
564 if ( node->ref_count <= 0 )
565 ftc_node_destroy( node, manager );
566
567 node = prev;
568
569 } while ( node && manager->cur_weight > manager->max_weight );
570 }
#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:185
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 628 of file ftcmanag.c.

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

579 {
580 FT_Error error = FT_ERR( Invalid_Argument );
582
583
584 if ( manager && clazz && acache )
585 {
586 FT_Memory memory = manager->memory;
587
588
589 if ( manager->num_caches >= FTC_MAX_CACHES )
590 {
591 error = FT_THROW( Too_Many_Caches );
592 FT_ERROR(( "FTC_Manager_RegisterCache:"
593 " too many registered caches\n" ));
594 goto Exit;
595 }
596
597 if ( !FT_ALLOC( cache, clazz->cache_size ) )
598 {
599 cache->manager = manager;
600 cache->memory = memory;
601 cache->clazz = clazz[0];
602 cache->org_class = clazz;
603
604 /* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */
605 /* IF IT IS NOT SET CORRECTLY */
606 cache->index = manager->num_caches;
607
608 error = clazz->cache_init( cache );
609 if ( error )
610 {
611 clazz->cache_done( cache );
612 FT_FREE( cache );
613 goto Exit;
614 }
615
616 manager->caches[manager->num_caches++] = cache;
617 }
618 }
619
620 Exit:
621 if ( acache )
622 *acache = cache;
623 return error;
624 }
#define FTC_MAX_CACHES
Definition: ftcmanag.h:88
#define FT_ERROR(varformat)
Definition: ftdebug.h:209
#define FT_THROW(e)
Definition: ftdebug.h:241
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:302
#define FT_FREE(ptr)
Definition: ftmemory.h:328
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
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: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().