1 |
/* |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Persistent Bitmap Cache routines |
Persistent Bitmap Cache routines |
4 |
Copyright (C) Jeroen Meijer 2004-2005 |
Copyright (C) Jeroen Meijer 2004-2005 |
24 |
|
|
25 |
#define IS_PERSISTENT(id) (id < 8 && g_pstcache_fd[id] > 0) |
#define IS_PERSISTENT(id) (id < 8 && g_pstcache_fd[id] > 0) |
26 |
|
|
27 |
extern int g_server_bpp; |
extern int g_server_depth; |
28 |
extern BOOL g_bitmap_cache; |
extern BOOL g_bitmap_cache; |
29 |
extern BOOL g_bitmap_cache_persist_enable; |
extern BOOL g_bitmap_cache_persist_enable; |
30 |
extern BOOL g_bitmap_cache_precache; |
extern BOOL g_bitmap_cache_precache; |
81 |
/* Store a bitmap in the persistent cache */ |
/* Store a bitmap in the persistent cache */ |
82 |
BOOL |
BOOL |
83 |
pstcache_save_bitmap(uint8 cache_id, uint16 cache_idx, uint8 * key, |
pstcache_save_bitmap(uint8 cache_id, uint16 cache_idx, uint8 * key, |
84 |
uint16 width, uint16 height, uint16 length, uint8 * data) |
uint8 width, uint8 height, uint16 length, uint8 * data) |
85 |
{ |
{ |
86 |
int fd; |
int fd; |
87 |
CELLHEADER cellhdr; |
CELLHEADER cellhdr; |
107 |
int |
int |
108 |
pstcache_enumerate(uint8 id, HASH_KEY * keylist) |
pstcache_enumerate(uint8 id, HASH_KEY * keylist) |
109 |
{ |
{ |
110 |
int fd, idx, n; |
int fd, n; |
111 |
|
uint16 idx; |
112 |
sint16 mru_idx[0xa00]; |
sint16 mru_idx[0xa00]; |
113 |
uint32 mru_stamp[0xa00]; |
uint32 mru_stamp[0xa00]; |
114 |
CELLHEADER cellhdr; |
CELLHEADER cellhdr; |
132 |
{ |
{ |
133 |
memcpy(keylist[idx], cellhdr.key, sizeof(HASH_KEY)); |
memcpy(keylist[idx], cellhdr.key, sizeof(HASH_KEY)); |
134 |
|
|
135 |
/* Pre-cache (not possible for 8bpp because 8bpp needs a colourmap) */ |
/* Pre-cache (not possible for 8 bit colour depth cause it needs a colourmap) */ |
136 |
if (g_bitmap_cache_precache && cellhdr.stamp && g_server_bpp > 8) |
if (g_bitmap_cache_precache && cellhdr.stamp && g_server_depth > 8) |
137 |
pstcache_load_bitmap(id, idx); |
pstcache_load_bitmap(id, idx); |
138 |
|
|
139 |
/* Sort by stamp */ |
/* Sort by stamp */ |
180 |
return False; |
return False; |
181 |
} |
} |
182 |
|
|
183 |
g_pstcache_Bpp = (g_server_bpp + 7) / 8; |
g_pstcache_Bpp = (g_server_depth + 7) / 8; |
184 |
sprintf(filename, "cache/pstcache_%d_%d", cache_id, g_pstcache_Bpp); |
sprintf(filename, "cache/pstcache_%d_%d", cache_id, g_pstcache_Bpp); |
185 |
DEBUG(("persistent bitmap cache file: %s\n", filename)); |
DEBUG(("persistent bitmap cache file: %s\n", filename)); |
186 |
|
|