blob: e8c9801d19676e5fba9d25fdf2d1e7314efebb74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#pragma once
#include <mutex>
extern "C" {
#include "mupdf/fitz.h"
}
#define MAX_DISPLAY_CACHE_SIZE 3
typedef struct cache_entry_s cache_entry_t;
struct cache_entry_s
{
int number;
int width;
int height;
fz_display_list *dlist;
cache_entry_t *next;
cache_entry_t *prev;
int index;
};
class Cache
{
private:
int size;
cache_entry_t *head;
cache_entry_t *tail;
std::mutex cache_lock;
public:
Cache(void);
~Cache(void);
void GetSize(int *width, int *height);
fz_display_list* Use(int value, int *width, int *height, fz_context *mu_ctx);
void Add(int value, int width, int height, fz_display_list *dlist, fz_context *mu_ctx);
void Empty(fz_context *mu_ctx);
};
|