1 |
|
/* |
2 |
|
* video_blit.cpp - Video/graphics emulation, blitters |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2004 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2005 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
302 |
|
#include "video_blit.h" |
303 |
|
|
304 |
|
/* -------------------------------------------------------------------------- */ |
305 |
< |
/* --- 1/2/4-bit indexed to 8-bit mode conversion --- */ |
305 |
> |
/* --- 1/2/4-bit indexed to 8-bit mode conversion --- */ |
306 |
|
/* -------------------------------------------------------------------------- */ |
307 |
|
|
308 |
|
static void Blit_Expand_1_To_8(uint8 * dest, const uint8 * p, uint32 length) |
344 |
|
} |
345 |
|
|
346 |
|
/* -------------------------------------------------------------------------- */ |
347 |
< |
/* --- 2/4/8-bit indexed to 16-bit mode color expansion --- */ |
347 |
> |
/* --- 1/2/4/8-bit indexed to 16-bit mode color expansion --- */ |
348 |
|
/* -------------------------------------------------------------------------- */ |
349 |
|
|
350 |
+ |
static void Blit_Expand_1_To_16(uint8 * dest, const uint8 * p, uint32 length) |
351 |
+ |
{ |
352 |
+ |
uint16 *q = (uint16 *)dest; |
353 |
+ |
for (uint32 i=0; i<length; i++) { |
354 |
+ |
uint8 c = *p++; |
355 |
+ |
*q++ = -(c >> 7); |
356 |
+ |
*q++ = -((c >> 6) & 1); |
357 |
+ |
*q++ = -((c >> 5) & 1); |
358 |
+ |
*q++ = -((c >> 4) & 1); |
359 |
+ |
*q++ = -((c >> 3) & 1); |
360 |
+ |
*q++ = -((c >> 2) & 1); |
361 |
+ |
*q++ = -((c >> 1) & 1); |
362 |
+ |
*q++ = -(c & 1); |
363 |
+ |
} |
364 |
+ |
} |
365 |
+ |
|
366 |
|
static void Blit_Expand_2_To_16(uint8 * dest, const uint8 * p, uint32 length) |
367 |
|
{ |
368 |
|
uint16 *q = (uint16 *)dest; |
393 |
|
} |
394 |
|
|
395 |
|
/* -------------------------------------------------------------------------- */ |
396 |
< |
/* --- 2/4/8-bit indexed to 32-bit mode color expansion --- */ |
396 |
> |
/* --- 1/2/4/8-bit indexed to 32-bit mode color expansion --- */ |
397 |
|
/* -------------------------------------------------------------------------- */ |
398 |
|
|
399 |
+ |
static void Blit_Expand_1_To_32(uint8 * dest, const uint8 * p, uint32 length) |
400 |
+ |
{ |
401 |
+ |
uint32 *q = (uint32 *)dest; |
402 |
+ |
for (uint32 i=0; i<length; i++) { |
403 |
+ |
uint8 c = *p++; |
404 |
+ |
*q++ = -(c >> 7); |
405 |
+ |
*q++ = -((c >> 6) & 1); |
406 |
+ |
*q++ = -((c >> 5) & 1); |
407 |
+ |
*q++ = -((c >> 4) & 1); |
408 |
+ |
*q++ = -((c >> 3) & 1); |
409 |
+ |
*q++ = -((c >> 2) & 1); |
410 |
+ |
*q++ = -((c >> 1) & 1); |
411 |
+ |
*q++ = -(c & 1); |
412 |
+ |
} |
413 |
+ |
} |
414 |
+ |
|
415 |
|
static void Blit_Expand_2_To_32(uint8 * dest, const uint8 * p, uint32 length) |
416 |
|
{ |
417 |
|
uint32 *q = (uint32 *)dest; |
498 |
|
const bool use_sdl_video = false; |
499 |
|
#endif |
500 |
|
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
501 |
< |
if (!use_sdl_video && mac_depth == 1) { |
501 |
> |
if (mac_depth == 1 && !use_sdl_video && !visual_format.fullscreen) { |
502 |
|
|
503 |
< |
// 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines |
503 |
> |
// Windowed 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines |
504 |
|
Screen_blit = Blit_Copy_Raw; |
505 |
|
|
506 |
|
} else { |
530 |
|
case 15: |
531 |
|
case 16: |
532 |
|
switch (mac_depth) { |
533 |
+ |
case 1: Screen_blit = Blit_Expand_1_To_16; break; |
534 |
|
case 2: Screen_blit = Blit_Expand_2_To_16; break; |
535 |
|
case 4: Screen_blit = Blit_Expand_4_To_16; break; |
536 |
|
case 8: Screen_blit = Blit_Expand_8_To_16; break; |
539 |
|
case 24: |
540 |
|
case 32: |
541 |
|
switch (mac_depth) { |
542 |
+ |
case 1: Screen_blit = Blit_Expand_1_To_32; break; |
543 |
|
case 2: Screen_blit = Blit_Expand_2_To_32; break; |
544 |
|
case 4: Screen_blit = Blit_Expand_4_To_32; break; |
545 |
|
case 8: Screen_blit = Blit_Expand_8_To_32; break; |