24 |
|
|
25 |
|
|
26 |
/* BITMAP CACHE */ |
/* BITMAP CACHE */ |
27 |
static HBITMAP bmpcache[3][600]; |
static HBITMAP g_bmpcache[3][600]; |
28 |
|
|
29 |
/* Retrieve a bitmap from the cache */ |
/* Retrieve a bitmap from the cache */ |
30 |
HBITMAP |
HBITMAP |
32 |
{ |
{ |
33 |
HBITMAP bitmap; |
HBITMAP bitmap; |
34 |
|
|
35 |
if ((cache_id < NUM_ELEMENTS(bmpcache)) && (cache_idx < NUM_ELEMENTS(bmpcache[0]))) |
if ((cache_id < NUM_ELEMENTS(g_bmpcache)) && (cache_idx < NUM_ELEMENTS(g_bmpcache[0]))) |
36 |
{ |
{ |
37 |
bitmap = bmpcache[cache_id][cache_idx]; |
bitmap = g_bmpcache[cache_id][cache_idx]; |
38 |
if (bitmap != NULL) |
if (bitmap != NULL) |
39 |
return bitmap; |
return bitmap; |
40 |
} |
} |
49 |
{ |
{ |
50 |
HBITMAP old; |
HBITMAP old; |
51 |
|
|
52 |
if ((cache_id < NUM_ELEMENTS(bmpcache)) && (cache_idx < NUM_ELEMENTS(bmpcache[0]))) |
if ((cache_id < NUM_ELEMENTS(g_bmpcache)) && (cache_idx < NUM_ELEMENTS(g_bmpcache[0]))) |
53 |
{ |
{ |
54 |
old = bmpcache[cache_id][cache_idx]; |
old = g_bmpcache[cache_id][cache_idx]; |
55 |
if (old != NULL) |
if (old != NULL) |
56 |
ui_destroy_bitmap(old); |
ui_destroy_bitmap(old); |
57 |
|
|
58 |
bmpcache[cache_id][cache_idx] = bitmap; |
g_bmpcache[cache_id][cache_idx] = bitmap; |
59 |
} |
} |
60 |
else |
else |
61 |
{ |
{ |
65 |
|
|
66 |
|
|
67 |
/* FONT CACHE */ |
/* FONT CACHE */ |
68 |
static FONTGLYPH fontcache[12][256]; |
static FONTGLYPH g_fontcache[12][256]; |
69 |
|
|
70 |
/* Retrieve a glyph from the font cache */ |
/* Retrieve a glyph from the font cache */ |
71 |
FONTGLYPH * |
FONTGLYPH * |
73 |
{ |
{ |
74 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
75 |
|
|
76 |
if ((font < NUM_ELEMENTS(fontcache)) && (character < NUM_ELEMENTS(fontcache[0]))) |
if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0]))) |
77 |
{ |
{ |
78 |
glyph = &fontcache[font][character]; |
glyph = &g_fontcache[font][character]; |
79 |
if (glyph->pixmap != NULL) |
if (glyph->pixmap != NULL) |
80 |
return glyph; |
return glyph; |
81 |
} |
} |
91 |
{ |
{ |
92 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
93 |
|
|
94 |
if ((font < NUM_ELEMENTS(fontcache)) && (character < NUM_ELEMENTS(fontcache[0]))) |
if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0]))) |
95 |
{ |
{ |
96 |
glyph = &fontcache[font][character]; |
glyph = &g_fontcache[font][character]; |
97 |
if (glyph->pixmap != NULL) |
if (glyph->pixmap != NULL) |
98 |
ui_destroy_glyph(glyph->pixmap); |
ui_destroy_glyph(glyph->pixmap); |
99 |
|
|
111 |
|
|
112 |
|
|
113 |
/* TEXT CACHE */ |
/* TEXT CACHE */ |
114 |
static DATABLOB textcache[256]; |
static DATABLOB g_textcache[256]; |
115 |
|
|
116 |
/* Retrieve a text item from the cache */ |
/* Retrieve a text item from the cache */ |
117 |
DATABLOB * |
DATABLOB * |
119 |
{ |
{ |
120 |
DATABLOB *text; |
DATABLOB *text; |
121 |
|
|
122 |
if (cache_id < NUM_ELEMENTS(textcache)) |
if (cache_id < NUM_ELEMENTS(g_textcache)) |
123 |
{ |
{ |
124 |
text = &textcache[cache_id]; |
text = &g_textcache[cache_id]; |
125 |
if (text->data != NULL) |
if (text->data != NULL) |
126 |
return text; |
return text; |
127 |
} |
} |
136 |
{ |
{ |
137 |
DATABLOB *text; |
DATABLOB *text; |
138 |
|
|
139 |
if (cache_id < NUM_ELEMENTS(textcache)) |
if (cache_id < NUM_ELEMENTS(g_textcache)) |
140 |
{ |
{ |
141 |
text = &textcache[cache_id]; |
text = &g_textcache[cache_id]; |
142 |
if (text->data != NULL) |
if (text->data != NULL) |
143 |
xfree(text->data); |
xfree(text->data); |
144 |
|
|
154 |
|
|
155 |
|
|
156 |
/* DESKTOP CACHE */ |
/* DESKTOP CACHE */ |
157 |
static uint8 deskcache[0x38400 * 4]; |
static uint8 g_deskcache[0x38400 * 4]; |
158 |
|
|
159 |
/* Retrieve desktop data from the cache */ |
/* Retrieve desktop data from the cache */ |
160 |
uint8 * |
uint8 * |
162 |
{ |
{ |
163 |
int length = cx * cy * bytes_per_pixel; |
int length = cx * cy * bytes_per_pixel; |
164 |
|
|
165 |
if ((offset + length) <= sizeof(deskcache)) |
if ((offset + length) <= sizeof(g_deskcache)) |
166 |
{ |
{ |
167 |
return &deskcache[offset]; |
return &g_deskcache[offset]; |
168 |
} |
} |
169 |
|
|
170 |
error("get desktop %d:%d\n", offset, length); |
error("get desktop %d:%d\n", offset, length); |
177 |
{ |
{ |
178 |
int length = cx * cy * bytes_per_pixel; |
int length = cx * cy * bytes_per_pixel; |
179 |
|
|
180 |
if ((offset + length) <= sizeof(deskcache)) |
if ((offset + length) <= sizeof(g_deskcache)) |
181 |
{ |
{ |
182 |
cx *= bytes_per_pixel; |
cx *= bytes_per_pixel; |
183 |
while (cy--) |
while (cy--) |
184 |
{ |
{ |
185 |
memcpy(&deskcache[offset], data, cx); |
memcpy(&g_deskcache[offset], data, cx); |
186 |
data += scanline; |
data += scanline; |
187 |
offset += cx; |
offset += cx; |
188 |
} |
} |
195 |
|
|
196 |
|
|
197 |
/* CURSOR CACHE */ |
/* CURSOR CACHE */ |
198 |
static HCURSOR cursorcache[0x20]; |
static HCURSOR g_cursorcache[0x20]; |
199 |
|
|
200 |
/* Retrieve cursor from cache */ |
/* Retrieve cursor from cache */ |
201 |
HCURSOR |
HCURSOR |
203 |
{ |
{ |
204 |
HCURSOR cursor; |
HCURSOR cursor; |
205 |
|
|
206 |
if (cache_idx < NUM_ELEMENTS(cursorcache)) |
if (cache_idx < NUM_ELEMENTS(g_cursorcache)) |
207 |
{ |
{ |
208 |
cursor = cursorcache[cache_idx]; |
cursor = g_cursorcache[cache_idx]; |
209 |
if (cursor != NULL) |
if (cursor != NULL) |
210 |
return cursor; |
return cursor; |
211 |
} |
} |
220 |
{ |
{ |
221 |
HCURSOR old; |
HCURSOR old; |
222 |
|
|
223 |
if (cache_idx < NUM_ELEMENTS(cursorcache)) |
if (cache_idx < NUM_ELEMENTS(g_cursorcache)) |
224 |
{ |
{ |
225 |
old = cursorcache[cache_idx]; |
old = g_cursorcache[cache_idx]; |
226 |
if (old != NULL) |
if (old != NULL) |
227 |
ui_destroy_cursor(old); |
ui_destroy_cursor(old); |
228 |
|
|
229 |
cursorcache[cache_idx] = cursor; |
g_cursorcache[cache_idx] = cursor; |
230 |
} |
} |
231 |
else |
else |
232 |
{ |
{ |