summaryrefslogtreecommitdiffstats
path: root/libass/ass_cache.h
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2011-06-27 19:42:56 +0200
committerGrigori Goronzy <greg@blackbox>2011-06-27 19:51:32 +0200
commit30497b80dd25447df4c3a820d0f7f849dc725114 (patch)
tree1801af3258908769af4bc40a1f75824fc79be47c /libass/ass_cache.h
parentd14f08365d9ecd16e8c762d852b6a22d7cc2307d (diff)
downloadlibass-30497b80dd25447df4c3a820d0f7f849dc725114.tar.bz2
libass-30497b80dd25447df4c3a820d0f7f849dc725114.tar.xz
cache: fix size tracking and emptying
Diffstat (limited to 'libass/ass_cache.h')
-rw-r--r--libass/ass_cache.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/libass/ass_cache.h b/libass/ass_cache.h
index 0ad7cae..05903e7 100644
--- a/libass/ass_cache.h
+++ b/libass/ass_cache.h
@@ -26,6 +26,28 @@
typedef struct cache Cache;
+// cache values
+
+typedef struct {
+ Bitmap *bm; // the actual bitmaps
+ Bitmap *bm_o;
+ Bitmap *bm_s;
+} BitmapHashValue;
+
+typedef struct {
+ unsigned char *a;
+ unsigned char *b;
+} CompositeHashValue;
+
+typedef struct {
+ FT_Library lib;
+ FT_Outline *outline;
+ FT_Outline *border;
+ FT_BBox bbox_scaled; // bbox after scaling, but before rotation
+ FT_Vector advance; // 26.6, advance distance to the next outline in line
+ int asc, desc; // ascender/descender
+} OutlineHashValue;
+
// Create definitions for bitmap, outline and composite hash keys
#define CREATE_STRUCT_DEFINITIONS
#include "ass_cache_template.h"
@@ -49,34 +71,12 @@ typedef struct outline_hash_key {
} u;
} OutlineHashKey;
-// cache values
-
-typedef struct {
- Bitmap *bm; // the actual bitmaps
- Bitmap *bm_o;
- Bitmap *bm_s;
-} BitmapHashValue;
-
-typedef struct {
- unsigned char *a;
- unsigned char *b;
-} CompositeHashValue;
-
-typedef struct {
- FT_Library lib;
- FT_Outline *outline;
- FT_Outline *border;
- FT_BBox bbox_scaled; // bbox after scaling, but before rotation
- FT_Vector advance; // 26.6, advance distance to the next outline in line
- int asc, desc; // ascender/descender
-} OutlineHashValue;
-
Cache *ass_cache_create(HashFunction hash_func, HashCompare compare_func,
CacheItemDestructor destruct_func, ItemSize size_func,
size_t key_size, size_t value_size);
void *ass_cache_put(Cache *cache, void *key, void *value);
void *ass_cache_get(Cache *cache, void *key);
-size_t ass_cache_empty(Cache *cache, size_t max_size);
+int ass_cache_empty(Cache *cache, size_t max_size);
void ass_cache_stats(Cache *cache, size_t *size, unsigned *hits,
unsigned *misses, unsigned *count);
void ass_cache_done(Cache *cache);