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; |
131 |
{ |
{ |
132 |
memcpy(keylist[idx], cellhdr.key, sizeof(HASH_KEY)); |
memcpy(keylist[idx], cellhdr.key, sizeof(HASH_KEY)); |
133 |
|
|
134 |
/* 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) */ |
135 |
if (g_bitmap_cache_precache && cellhdr.stamp && g_server_bpp > 8) |
if (g_bitmap_cache_precache && cellhdr.stamp && g_server_depth > 8) |
136 |
pstcache_load_bitmap(id, idx); |
pstcache_load_bitmap(id, idx); |
137 |
|
|
138 |
/* Sort by stamp */ |
/* Sort by stamp */ |
179 |
return False; |
return False; |
180 |
} |
} |
181 |
|
|
182 |
g_pstcache_Bpp = (g_server_bpp + 7) / 8; |
g_pstcache_Bpp = (g_server_depth + 7) / 8; |
183 |
sprintf(filename, "cache/pstcache_%d_%d", cache_id, g_pstcache_Bpp); |
sprintf(filename, "cache/pstcache_%d_%d", cache_id, g_pstcache_Bpp); |
184 |
DEBUG(("persistent bitmap cache file: %s\n", filename)); |
DEBUG(("persistent bitmap cache file: %s\n", filename)); |
185 |
|
|