262 |
|
#include "video_blit.h" |
263 |
|
|
264 |
|
/* -------------------------------------------------------------------------- */ |
265 |
+ |
/* --- 2/4-bit indexed to 8-bit mode conversion --- */ |
266 |
+ |
/* -------------------------------------------------------------------------- */ |
267 |
+ |
|
268 |
+ |
static void Blit_Expand_2_To_8(uint8 * dest, const uint8 * p, uint32 length) |
269 |
+ |
{ |
270 |
+ |
uint8 *q = (uint8 *)dest; |
271 |
+ |
for (int i=0; i<length; i++) { |
272 |
+ |
uint8 c = *p++; |
273 |
+ |
*q++ = c >> 6; |
274 |
+ |
*q++ = (c >> 4) & 3; |
275 |
+ |
*q++ = (c >> 2) & 3; |
276 |
+ |
*q++ = c & 3; |
277 |
+ |
} |
278 |
+ |
} |
279 |
+ |
|
280 |
+ |
static void Blit_Expand_4_To_8(uint8 * dest, const uint8 * p, uint32 length) |
281 |
+ |
{ |
282 |
+ |
uint8 *q = (uint8 *)dest; |
283 |
+ |
for (int i=0; i<length; i++) { |
284 |
+ |
uint8 c = *p++; |
285 |
+ |
*q++ = c >> 4; |
286 |
+ |
*q++ = c & 0x0f; |
287 |
+ |
} |
288 |
+ |
} |
289 |
+ |
|
290 |
+ |
/* -------------------------------------------------------------------------- */ |
291 |
|
/* --- 2/4/8-bit indexed to 16-bit mode color expansion --- */ |
292 |
|
/* -------------------------------------------------------------------------- */ |
293 |
|
|
428 |
|
|
429 |
|
bool blitter_found = false; |
430 |
|
|
431 |
< |
// 2/4/8-bit mode on 16/32-bit screen? |
432 |
< |
if (visualFormat.depth > 8) { |
431 |
> |
// 2/4/8-bit mode on 8/16/32-bit screen? |
432 |
> |
if (visualFormat.depth == 8) { |
433 |
> |
if (mac_depth == VDEPTH_2BIT) { |
434 |
> |
Screen_blit = Blit_Expand_2_To_8; |
435 |
> |
blitter_found = true; |
436 |
> |
} else if (mac_depth == VDEPTH_4BIT) { |
437 |
> |
Screen_blit = Blit_Expand_4_To_8; |
438 |
> |
blitter_found = true; |
439 |
> |
} |
440 |
> |
} else if (visualFormat.depth == 15 || visualFormat.depth == 16) { |
441 |
> |
if (mac_depth == VDEPTH_2BIT) { |
442 |
> |
Screen_blit = Blit_Expand_2_To_16; |
443 |
> |
blitter_found = true; |
444 |
> |
} else if (mac_depth == VDEPTH_4BIT) { |
445 |
> |
Screen_blit = Blit_Expand_4_To_16; |
446 |
> |
blitter_found = true; |
447 |
> |
} else if (mac_depth == VDEPTH_8BIT) { |
448 |
> |
Screen_blit = Blit_Expand_8_To_16; |
449 |
> |
blitter_found = true; |
450 |
> |
} |
451 |
> |
} else if (visualFormat.depth == 24 || visualFormat.depth == 32) { |
452 |
|
if (mac_depth == VDEPTH_2BIT) { |
453 |
< |
if (visual_info->depth <= 16) { |
454 |
< |
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 |
< |
} |
453 |
> |
Screen_blit = Blit_Expand_2_To_32; |
454 |
> |
blitter_found = true; |
455 |
|
} else if (mac_depth == VDEPTH_4BIT) { |
456 |
< |
if (visual_info->depth <= 16) { |
457 |
< |
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 |
< |
} |
456 |
> |
Screen_blit = Blit_Expand_4_To_32; |
457 |
> |
blitter_found = true; |
458 |
|
} else if (mac_depth == VDEPTH_8BIT) { |
459 |
< |
if (visual_info->depth <= 16) { |
460 |
< |
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 |
< |
} |
459 |
> |
Screen_blit = Blit_Expand_8_To_32; |
460 |
> |
blitter_found = true; |
461 |
|
} |
462 |
|
} |
463 |
|
|