Added 8-bit RGB source surface support to NtoN blitters

This commit is contained in:
Sam Lantinga 2013-07-06 21:17:09 -07:00
parent 185f93a7a9
commit c9acdd87a7
2 changed files with 326 additions and 296 deletions

View file

@ -145,6 +145,10 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel) \
do { \
switch (bpp) { \
case 1: \
Pixel = *((Uint8 *)(buf)); \
break; \
\
case 2: \
Pixel = *((Uint16 *)(buf)); \
break; \
@ -172,6 +176,11 @@ do { \
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b) \
do { \
switch (bpp) { \
case 1: \
Pixel = *((Uint8 *)(buf)); \
RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
break; \
\
case 2: \
Pixel = *((Uint16 *)(buf)); \
RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
@ -243,6 +252,14 @@ do { \
#define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) \
{ \
switch (bpp) { \
case 1: { \
Uint8 Pixel; \
\
PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
*((Uint8 *)(buf)) = Pixel; \
} \
break; \
\
case 2: { \
Uint16 Pixel; \
\
@ -320,6 +337,11 @@ do { \
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a) \
do { \
switch (bpp) { \
case 1: \
Pixel = *((Uint8 *)(buf)); \
RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
break; \
\
case 2: \
Pixel = *((Uint16 *)(buf)); \
RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
@ -364,6 +386,14 @@ do { \
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
{ \
switch (bpp) { \
case 1: { \
Uint8 Pixel; \
\
PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a); \
*((Uint8 *)(buf)) = Pixel; \
} \
break; \
\
case 2: { \
Uint16 Pixel; \
\

View file

@ -2344,8 +2344,8 @@ struct blit_table
{ NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha;
};
static const struct blit_table normal_blit_1[] = {
/* Default for 8-bit RGB source, an invalid combination */
{0, 0, 0, 0, 0, 0, 0, 0, NULL},
/* Default for 8-bit RGB source, never optimized */
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
};
static const struct blit_table normal_blit_2[] = {