From e8862d8cbe87672b953ff8c5fcba05fdd9152ae2 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Wed, 31 Jan 2001 21:28:58 +0000 Subject: [PATCH] - Added blitters for BGR 555 mode --- BasiliskII/src/Unix/video_blit.cpp | 67 +++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/BasiliskII/src/Unix/video_blit.cpp b/BasiliskII/src/Unix/video_blit.cpp index aced22d0..30d9ec35 100644 --- a/BasiliskII/src/Unix/video_blit.cpp +++ b/BasiliskII/src/Unix/video_blit.cpp @@ -67,8 +67,59 @@ static void Blit_Copy_Raw(uint8 * dest, const uint8 * source, uint32 length) /* --- BGR 555 --- */ /* -------------------------------------------------------------------------- */ -// TODO: BGR 555 (SGI/Irix) -// R/G/B mask values: 0x001f, 0x03e0, 0x7c00 +#ifdef WORDS_BIGENDIAN + +// Native byte order + +#define FB_BLIT_1(dst, src) \ + (dst = (((src) >> 10) & 0x001f) | ((src) & 0x03e0) | (((src) << 10) & 0x7c00)) + +#define FB_BLIT_2(dst, src) \ + (dst = (((src) >> 10) & 0x001f001f) | ((src) & 0x03e003e0) | (((src) << 10) & 0x7c007c00)) + +#define FB_DEPTH 15 +#define FB_FUNC_NAME Blit_BGR555_NBO +#include "video_blit.h" + +// Opposite byte order (untested) + +#define FB_BLIT_1(dst, src) \ + (dst = (((src) >> 2) & 0x1f00) | (((src) >> 8) & 3) | (((src) << 8) & 0xe000) | (((src) << 2) & 0x7c)) + +#define FB_BLIT_2(dst, src) \ + (dst = (((src) >> 2) & 0x1f001f00) | (((src) >> 8) & 0x30003) | (((src) << 8) & 0xe000e000) | (((src) << 2) & 0x7c007c)) + +#define FB_DEPTH 15 +#define FB_FUNC_NAME Blit_BGR555_OBO +#include "video_blit.h" + +#else + +// Native byte order (untested) + +#define FB_BLIT_1(dst, src) \ + (dst = (((src) >> 2) & 0x1f) | (((src) >> 8) & 0xe0) | (((src) << 8) & 0x0300) | (((src) << 2) & 0x7c00)) + +#define FB_BLIT_2(dst, src) \ + (dst = (((src) >> 2) & 0x1f001f) | (((src) >> 8) & 0xe000e0) | (((src) << 8) & 0x03000300) | (((src) << 2) & 0x7c007c00)) + +#define FB_DEPTH 15 +#define FB_FUNC_NAME Blit_BGR555_NBO +#include "video_blit.h" + +// Opposite byte order (untested) + +#define FB_BLIT_1(dst, src) \ + (dst = (((src) << 6) & 0x1f00) | ((src) & 0xe003) | (((src) >> 6) & 0x7c)) + +#define FB_BLIT_2(dst, src) \ + (dst = (((src) << 6) & 0x1f001f00) | ((src) & 0xe003e003) | (((src) >> 6) & 0x7c007c)) + +#define FB_DEPTH 15 +#define FB_FUNC_NAME Blit_BGR555_OBO +#include "video_blit.h" + +#endif /* -------------------------------------------------------------------------- */ /* --- RGB 565 --- */ @@ -168,7 +219,7 @@ static void Blit_Copy_Raw(uint8 * dest, const uint8 * source, uint32 length) /* --- BGR 888 --- */ /* -------------------------------------------------------------------------- */ -// Native byte order (untested) +// Native byte order [BE] (untested) #ifdef WORDS_BIGENDIAN @@ -181,6 +232,8 @@ static void Blit_Copy_Raw(uint8 * dest, const uint8 * source, uint32 length) #else +// Opposite byte order [LE] (untested) + #define FB_BLIT_2(dst, src) \ (dst = (((src) >> 16) & 0xff) | ((src) & 0xff0000) | (((src) & 0xff) << 16)) @@ -190,7 +243,7 @@ static void Blit_Copy_Raw(uint8 * dest, const uint8 * source, uint32 length) #endif -// Opposite byte order (untested) +// Opposite byte order [BE] (untested) / Native byte order [LE] (untested) #ifdef WORDS_BIGENDIAN # define FB_FUNC_NAME Blit_BGR888_OBO @@ -229,15 +282,17 @@ static Screen_blit_func_info Screen_blitters[] = { { 1, 0x000000, 0x000000, 0x000000, Blit_Copy_Raw , Blit_Copy_Raw }, // NT { 8, 0x000000, 0x000000, 0x000000, Blit_Copy_Raw , Blit_Copy_Raw }, // OK (NBO) { 15, 0x007c00, 0x0003e0, 0x00001f, Blit_Copy_Raw , Blit_RGB555_OBO }, // OK (OBO) + { 15, 0x00001f, 0x0003e0, 0x007c00, Blit_BGR555_NBO , Blit_BGR555_OBO }, // NT { 16, 0x00f800, 0x0007e0, 0x00001f, Blit_RGB565_NBO , Blit_RGB565_OBO }, // OK (OBO) { 24, 0xff0000, 0x00ff00, 0x0000ff, Blit_Copy_Raw , Blit_RGB888_OBO }, // OK (OBO) { 24, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO }, // NT - { 32, 0xff0000, 0x00ff00, 0x0000ff, Blit_Copy_Raw , Blit_RGB888_OBO }, // OK (OBO) - { 32, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO } // NT + { 32, 0xff0000, 0x00ff00, 0x0000ff, Blit_Copy_Raw , Blit_RGB888_OBO }, // OK + { 32, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO } // OK #else { 1, 0x000000, 0x000000, 0x000000, Blit_Copy_Raw , Blit_Copy_Raw }, // NT { 8, 0x000000, 0x000000, 0x000000, Blit_Copy_Raw , Blit_Copy_Raw }, // OK (NBO) { 15, 0x007c00, 0x0003e0, 0x00001f, Blit_RGB555_NBO , Blit_Copy_Raw }, // OK (NBO) + { 15, 0x00001f, 0x0003e0, 0x007c00, Blit_BGR555_NBO , Blit_BGR555_OBO }, // NT { 16, 0x00f800, 0x0007e0, 0x00001f, Blit_RGB565_NBO , Blit_RGB565_OBO }, // OK (NBO) { 24, 0xff0000, 0x00ff00, 0x0000ff, Blit_RGB888_NBO , Blit_Copy_Raw }, // OK (NBO) { 24, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO }, // NT