262 |
|
#include "video_blit.h" |
263 |
|
|
264 |
|
/* -------------------------------------------------------------------------- */ |
265 |
< |
/* --- 8-bit indexed to 16-bit mode color expansion --- */ |
265 |
> |
/* --- 2/4/8-bit indexed to 16-bit mode color expansion --- */ |
266 |
|
/* -------------------------------------------------------------------------- */ |
267 |
|
|
268 |
+ |
static void Blit_Expand_2_To_16(uint8 * dest, const uint8 * p, uint32 length) |
269 |
+ |
{ |
270 |
+ |
uint16 *q = (uint16 *)dest; |
271 |
+ |
for (int i=0; i<length; i++) { |
272 |
+ |
uint8 c = *p++; |
273 |
+ |
*q++ = ExpandMap[c >> 6]; |
274 |
+ |
*q++ = ExpandMap[c >> 4]; |
275 |
+ |
*q++ = ExpandMap[c >> 2]; |
276 |
+ |
*q++ = ExpandMap[c]; |
277 |
+ |
} |
278 |
+ |
} |
279 |
+ |
|
280 |
+ |
static void Blit_Expand_4_To_16(uint8 * dest, const uint8 * p, uint32 length) |
281 |
+ |
{ |
282 |
+ |
uint16 *q = (uint16 *)dest; |
283 |
+ |
for (int i=0; i<length; i++) { |
284 |
+ |
uint8 c = *p++; |
285 |
+ |
*q++ = ExpandMap[c >> 4]; |
286 |
+ |
*q++ = ExpandMap[c]; |
287 |
+ |
} |
288 |
+ |
} |
289 |
+ |
|
290 |
|
static void Blit_Expand_8_To_16(uint8 * dest, const uint8 * p, uint32 length) |
291 |
|
{ |
292 |
|
uint16 *q = (uint16 *)dest; |
295 |
|
} |
296 |
|
|
297 |
|
/* -------------------------------------------------------------------------- */ |
298 |
< |
/* --- 8-bit indexed to 32-bit mode color expansion --- */ |
298 |
> |
/* --- 2/4/8-bit indexed to 32-bit mode color expansion --- */ |
299 |
|
/* -------------------------------------------------------------------------- */ |
300 |
|
|
301 |
+ |
static void Blit_Expand_2_To_32(uint8 * dest, const uint8 * p, uint32 length) |
302 |
+ |
{ |
303 |
+ |
uint32 *q = (uint32 *)dest; |
304 |
+ |
for (int i=0; i<length; i++) { |
305 |
+ |
uint8 c = *p++; |
306 |
+ |
*q++ = ExpandMap[c >> 6]; |
307 |
+ |
*q++ = ExpandMap[c >> 4]; |
308 |
+ |
*q++ = ExpandMap[c >> 2]; |
309 |
+ |
*q++ = ExpandMap[c]; |
310 |
+ |
} |
311 |
+ |
} |
312 |
+ |
|
313 |
+ |
static void Blit_Expand_4_To_32(uint8 * dest, const uint8 * p, uint32 length) |
314 |
+ |
{ |
315 |
+ |
uint32 *q = (uint32 *)dest; |
316 |
+ |
for (int i=0; i<length; i++) { |
317 |
+ |
uint8 c = *p++; |
318 |
+ |
*q++ = ExpandMap[c >> 4]; |
319 |
+ |
*q++ = ExpandMap[c]; |
320 |
+ |
} |
321 |
+ |
} |
322 |
+ |
|
323 |
|
static void Blit_Expand_8_To_32(uint8 * dest, const uint8 * p, uint32 length) |
324 |
|
{ |
325 |
|
uint32 *q = (uint32 *)dest; |
402 |
|
|
403 |
|
bool blitter_found = false; |
404 |
|
|
405 |
< |
// 8-bit mode on 16/32-bit screen? |
406 |
< |
if (mac_depth == VDEPTH_8BIT && visualFormat.depth > 8) { |
407 |
< |
if (visual_info->depth <= 16) { |
408 |
< |
Screen_blit = Blit_Expand_8_To_16; |
409 |
< |
blitter_found = true; |
410 |
< |
} else { |
411 |
< |
Screen_blit = Blit_Expand_8_To_32; |
412 |
< |
blitter_found = true; |
405 |
> |
// 2/4/8-bit mode on 16/32-bit screen? |
406 |
> |
if (visualFormat.depth > 8) { |
407 |
> |
if (mac_depth == VDEPTH_2BIT) { |
408 |
> |
if (visual_info->depth <= 16) { |
409 |
> |
Screen_blit = Blit_Expand_2_To_16; |
410 |
> |
blitter_found = true; |
411 |
> |
} else { |
412 |
> |
Screen_blit = Blit_Expand_2_To_32; |
413 |
> |
blitter_found = true; |
414 |
> |
} |
415 |
> |
} else if (mac_depth == VDEPTH_4BIT) { |
416 |
> |
if (visual_info->depth <= 16) { |
417 |
> |
Screen_blit = Blit_Expand_4_To_16; |
418 |
> |
blitter_found = true; |
419 |
> |
} else { |
420 |
> |
Screen_blit = Blit_Expand_4_To_32; |
421 |
> |
blitter_found = true; |
422 |
> |
} |
423 |
> |
} else if (mac_depth == VDEPTH_8BIT) { |
424 |
> |
if (visual_info->depth <= 16) { |
425 |
> |
Screen_blit = Blit_Expand_8_To_16; |
426 |
> |
blitter_found = true; |
427 |
> |
} else { |
428 |
> |
Screen_blit = Blit_Expand_8_To_32; |
429 |
> |
blitter_found = true; |
430 |
> |
} |
431 |
|
} |
432 |
|
} |
433 |
|
|