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 * |
uint8 * |
165 |
cache_get_desktop(uint32 offset, int cx, int cy) |
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 |
{ |
{ |
177 |
|
|
178 |
/* Store desktop data in the cache */ |
/* Store desktop data in the cache */ |
179 |
void |
void |
180 |
cache_put_desktop(uint32 offset, int cx, int cy, int scanline, 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 |
|
} |