32 |
|
|
33 |
/* BITMAP CACHE */ |
/* BITMAP CACHE */ |
34 |
static BMPCACHEENTRY g_bmpcache[3][0xa00]; |
static BMPCACHEENTRY g_bmpcache[3][0xa00]; |
35 |
|
static HBITMAP g_volatile_bc[3]; |
36 |
|
|
37 |
/* Remove the least-recently used bitmap from the cache */ |
/* Remove the least-recently used bitmap from the cache */ |
38 |
void |
void |
40 |
{ |
{ |
41 |
int i; |
int i; |
42 |
uint16 cache_idx = 0; |
uint16 cache_idx = 0; |
43 |
uint32 m = (uint32)-1; |
uint32 m = (uint32) - 1; |
44 |
BMPCACHEENTRY *pbce; |
BMPCACHEENTRY *pbce; |
45 |
|
|
46 |
for (i = 0; i < NUM_ELEMENTS(g_bmpcache[cache_id]); i++) |
for (i = 0; i < NUM_ELEMENTS(g_bmpcache[cache_id]); i++) |
76 |
return *pbitmap; |
return *pbitmap; |
77 |
} |
} |
78 |
} |
} |
79 |
|
else if ((cache_id < NUM_ELEMENTS(g_volatile_bc)) && (cache_idx == 0x7fff)) |
80 |
|
{ |
81 |
|
return g_volatile_bc[cache_id]; |
82 |
|
} |
83 |
|
|
84 |
error("get bitmap %d:%d\n", cache_id, cache_idx); |
error("get bitmap %d:%d\n", cache_id, cache_idx); |
85 |
return NULL; |
return NULL; |
107 |
g_bmpcache[cache_id][cache_idx].bitmap = bitmap; |
g_bmpcache[cache_id][cache_idx].bitmap = bitmap; |
108 |
g_bmpcache[cache_id][cache_idx].usage = stamp; |
g_bmpcache[cache_id][cache_idx].usage = stamp; |
109 |
} |
} |
110 |
|
else if ((cache_id < NUM_ELEMENTS(g_volatile_bc)) && (cache_idx == 0x7fff)) |
111 |
|
{ |
112 |
|
old = g_volatile_bc[cache_id]; |
113 |
|
if (old != NULL) |
114 |
|
ui_destroy_bitmap(old); |
115 |
|
g_volatile_bc[cache_id] = bitmap; |
116 |
|
} |
117 |
else |
else |
118 |
{ |
{ |
119 |
error("put bitmap %d:%d\n", cache_id, cache_idx); |
error("put bitmap %d:%d\n", cache_id, cache_idx); |