2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Cache routines |
Cache routines |
4 |
Copyright (C) Matthew Chapman 1999-2002 |
Copyright (C) Matthew Chapman 1999-2002 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
9 |
(at your option) any later version. |
(at your option) any later version. |
10 |
|
|
11 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
GNU General Public License for more details. |
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
17 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
18 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 |
#define IS_PERSISTENT(id) (g_pstcache_fd[id] > 0) |
#define IS_PERSISTENT(id) (g_pstcache_fd[id] > 0) |
26 |
|
|
27 |
extern int g_pstcache_fd[]; |
extern int g_pstcache_fd[]; |
28 |
|
extern BOOL g_use_rdp5; |
29 |
|
|
30 |
uint32 g_stamp; |
uint32 g_stamp; |
|
int g_num_bitmaps_in_memory[3]; |
|
31 |
|
|
32 |
|
static int g_num_bitmaps_in_memory[3]; |
33 |
|
|
34 |
/* BITMAP CACHE */ |
/* BITMAP CACHE */ |
35 |
static BMPCACHEENTRY g_bmpcache[3][0xa00]; |
static BMPCACHEENTRY g_bmpcache[3][0xa00]; |
41 |
{ |
{ |
42 |
int i; |
int i; |
43 |
uint16 cache_idx = 0; |
uint16 cache_idx = 0; |
44 |
uint32 m = (uint32)-1; |
uint32 m = 0xffffffff; |
45 |
BMPCACHEENTRY *pbce; |
BMPCACHEENTRY *pbce; |
46 |
|
|
47 |
for (i = 0; i < NUM_ELEMENTS(g_bmpcache[cache_id]); i++) |
for (i = 0; i < NUM_ELEMENTS(g_bmpcache[cache_id]); i++) |
99 |
{ |
{ |
100 |
ui_destroy_bitmap(old); |
ui_destroy_bitmap(old); |
101 |
} |
} |
102 |
else |
else if (g_use_rdp5) |
103 |
{ |
{ |
104 |
if (++g_num_bitmaps_in_memory[cache_id] > BMPCACHE2_C2_CELLS) |
if (++g_num_bitmaps_in_memory[cache_id] > BMPCACHE2_C2_CELLS) |
105 |
cache_remove_lru_bitmap(cache_id); |
cache_remove_lru_bitmap(cache_id); |