27 |
static HBITMAP bmpcache[3][600]; |
static HBITMAP bmpcache[3][600]; |
28 |
|
|
29 |
/* Retrieve a bitmap from the cache */ |
/* Retrieve a bitmap from the cache */ |
30 |
HBITMAP cache_get_bitmap(uint8 cache_id, uint16 cache_idx) |
HBITMAP |
31 |
|
cache_get_bitmap(uint8 cache_id, uint16 cache_idx) |
32 |
{ |
{ |
33 |
HBITMAP bitmap; |
HBITMAP bitmap; |
34 |
|
|
45 |
} |
} |
46 |
|
|
47 |
/* Store a bitmap in the cache */ |
/* Store a bitmap in the cache */ |
48 |
void cache_put_bitmap(uint8 cache_id, uint16 cache_idx, HBITMAP bitmap) |
void |
49 |
|
cache_put_bitmap(uint8 cache_id, uint16 cache_idx, HBITMAP bitmap) |
50 |
{ |
{ |
51 |
HBITMAP old; |
HBITMAP old; |
52 |
|
|
70 |
static FONTGLYPH fontcache[12][256]; |
static FONTGLYPH fontcache[12][256]; |
71 |
|
|
72 |
/* Retrieve a glyph from the font cache */ |
/* Retrieve a glyph from the font cache */ |
73 |
FONTGLYPH *cache_get_font(uint8 font, uint16 character) |
FONTGLYPH * |
74 |
|
cache_get_font(uint8 font, uint16 character) |
75 |
{ |
{ |
76 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
77 |
|
|
88 |
} |
} |
89 |
|
|
90 |
/* Store a glyph in the font cache */ |
/* Store a glyph in the font cache */ |
91 |
void cache_put_font(uint8 font, uint16 character, uint16 offset, |
void |
92 |
uint16 baseline, uint16 width, uint16 height, |
cache_put_font(uint8 font, uint16 character, uint16 offset, |
93 |
HGLYPH pixmap) |
uint16 baseline, uint16 width, uint16 height, HGLYPH pixmap) |
94 |
{ |
{ |
95 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
96 |
|
|
118 |
static DATABLOB textcache[256]; |
static DATABLOB textcache[256]; |
119 |
|
|
120 |
/* Retrieve a text item from the cache */ |
/* Retrieve a text item from the cache */ |
121 |
DATABLOB *cache_get_text(uint8 cache_id) |
DATABLOB * |
122 |
|
cache_get_text(uint8 cache_id) |
123 |
{ |
{ |
124 |
DATABLOB *text; |
DATABLOB *text; |
125 |
|
|
135 |
} |
} |
136 |
|
|
137 |
/* Store a text item in the cache */ |
/* Store a text item in the cache */ |
138 |
void cache_put_text(uint8 cache_id, void *data, int length) |
void |
139 |
|
cache_put_text(uint8 cache_id, void *data, int length) |
140 |
{ |
{ |
141 |
DATABLOB *text; |
DATABLOB *text; |
142 |
|
|
158 |
|
|
159 |
|
|
160 |
/* DESKTOP CACHE */ |
/* DESKTOP CACHE */ |
161 |
static uint8 deskcache[0x38400]; |
static uint8 deskcache[0x38400 * 4]; |
162 |
|
|
163 |
/* Retrieve desktop data from the cache */ |
/* Retrieve desktop data from the cache */ |
164 |
uint8 *cache_get_desktop(uint32 offset, int cx, int cy) |
uint8 * |
165 |
|
cache_get_desktop(uint32 offset, int cx, int cy, int bytes_per_pixel) |
166 |
{ |
{ |
167 |
int length = cx * cy; |
int length = cx * cy * bytes_per_pixel; |
168 |
|
|
169 |
if ((offset + length) <= sizeof(deskcache)) |
if ((offset + length) <= sizeof(deskcache)) |
170 |
{ |
{ |
176 |
} |
} |
177 |
|
|
178 |
/* Store desktop data in the cache */ |
/* Store desktop data in the cache */ |
179 |
void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, |
void |
180 |
uint8 *data) |
cache_put_desktop(uint32 offset, int cx, int cy, int scanline, |
181 |
|
int bytes_per_pixel, uint8 *data) |
182 |
{ |
{ |
183 |
int length = cx * cy; |
int length = cx * cy * bytes_per_pixel; |
184 |
|
|
185 |
if ((offset + length) <= sizeof(deskcache)) |
if ((offset + length) <= sizeof(deskcache)) |
186 |
{ |
{ |
187 |
|
cx *= bytes_per_pixel; |
188 |
while (cy--) |
while (cy--) |
189 |
{ |
{ |
190 |
memcpy(&deskcache[offset], data, cx); |
memcpy(&deskcache[offset], data, cx); |
197 |
ERROR("put desktop %d:%d\n", offset, length); |
ERROR("put desktop %d:%d\n", offset, length); |
198 |
} |
} |
199 |
} |
} |
200 |
|
|
201 |
|
|
202 |
|
/* CURSOR CACHE */ |
203 |
|
static HCURSOR cursorcache[0x20]; |
204 |
|
|
205 |
|
/* Retrieve cursor from cache */ |
206 |
|
HCURSOR cache_get_cursor(uint16 cache_idx) |
207 |
|
{ |
208 |
|
HCURSOR cursor; |
209 |
|
|
210 |
|
if (cache_idx < NUM_ELEMENTS(cursorcache)) |
211 |
|
{ |
212 |
|
cursor = cursorcache[cache_idx]; |
213 |
|
if (cursor != NULL) |
214 |
|
return cursor; |
215 |
|
} |
216 |
|
|
217 |
|
ERROR("get cursor %d\n", cache_idx); |
218 |
|
return NULL; |
219 |
|
} |
220 |
|
|
221 |
|
/* Store cursor in cache */ |
222 |
|
void |
223 |
|
cache_put_cursor(uint16 cache_idx, HCURSOR cursor) |
224 |
|
{ |
225 |
|
HCURSOR old; |
226 |
|
|
227 |
|
if (cache_idx < NUM_ELEMENTS(cursorcache)) |
228 |
|
{ |
229 |
|
old = cursorcache[cache_idx]; |
230 |
|
if (old != NULL) |
231 |
|
ui_destroy_cursor(old); |
232 |
|
|
233 |
|
cursorcache[cache_idx] = cursor; |
234 |
|
} |
235 |
|
else |
236 |
|
{ |
237 |
|
ERROR("put cursor %d\n", cache_idx); |
238 |
|
} |
239 |
|
} |