Added 8-bit RGB source surface support to NtoN blitters
This commit is contained in:
parent
185f93a7a9
commit
c9acdd87a7
2 changed files with 326 additions and 296 deletions
|
@ -125,7 +125,7 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
|
||||||
b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
|
b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
|
||||||
}
|
}
|
||||||
#define RGB_FROM_RGB565(Pixel, r, g, b) \
|
#define RGB_FROM_RGB565(Pixel, r, g, b) \
|
||||||
{ \
|
{ \
|
||||||
r = SDL_expand_byte[3][((Pixel&0xF800)>>11)]; \
|
r = SDL_expand_byte[3][((Pixel&0xF800)>>11)]; \
|
||||||
g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)]; \
|
g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)]; \
|
||||||
b = SDL_expand_byte[3][(Pixel&0x001F)]; \
|
b = SDL_expand_byte[3][(Pixel&0x001F)]; \
|
||||||
|
@ -145,6 +145,10 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
|
||||||
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel) \
|
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel) \
|
||||||
do { \
|
do { \
|
||||||
switch (bpp) { \
|
switch (bpp) { \
|
||||||
|
case 1: \
|
||||||
|
Pixel = *((Uint8 *)(buf)); \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
case 2: \
|
case 2: \
|
||||||
Pixel = *((Uint16 *)(buf)); \
|
Pixel = *((Uint16 *)(buf)); \
|
||||||
break; \
|
break; \
|
||||||
|
@ -172,6 +176,11 @@ do { \
|
||||||
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b) \
|
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b) \
|
||||||
do { \
|
do { \
|
||||||
switch (bpp) { \
|
switch (bpp) { \
|
||||||
|
case 1: \
|
||||||
|
Pixel = *((Uint8 *)(buf)); \
|
||||||
|
RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
case 2: \
|
case 2: \
|
||||||
Pixel = *((Uint16 *)(buf)); \
|
Pixel = *((Uint16 *)(buf)); \
|
||||||
RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
|
RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
|
||||||
|
@ -243,6 +252,14 @@ do { \
|
||||||
#define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) \
|
#define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) \
|
||||||
{ \
|
{ \
|
||||||
switch (bpp) { \
|
switch (bpp) { \
|
||||||
|
case 1: { \
|
||||||
|
Uint8 Pixel; \
|
||||||
|
\
|
||||||
|
PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
|
||||||
|
*((Uint8 *)(buf)) = Pixel; \
|
||||||
|
} \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
case 2: { \
|
case 2: { \
|
||||||
Uint16 Pixel; \
|
Uint16 Pixel; \
|
||||||
\
|
\
|
||||||
|
@ -320,6 +337,11 @@ do { \
|
||||||
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a) \
|
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a) \
|
||||||
do { \
|
do { \
|
||||||
switch (bpp) { \
|
switch (bpp) { \
|
||||||
|
case 1: \
|
||||||
|
Pixel = *((Uint8 *)(buf)); \
|
||||||
|
RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
case 2: \
|
case 2: \
|
||||||
Pixel = *((Uint16 *)(buf)); \
|
Pixel = *((Uint16 *)(buf)); \
|
||||||
RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
|
RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
|
||||||
|
@ -364,6 +386,14 @@ do { \
|
||||||
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
|
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
|
||||||
{ \
|
{ \
|
||||||
switch (bpp) { \
|
switch (bpp) { \
|
||||||
|
case 1: { \
|
||||||
|
Uint8 Pixel; \
|
||||||
|
\
|
||||||
|
PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a); \
|
||||||
|
*((Uint8 *)(buf)) = Pixel; \
|
||||||
|
} \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
case 2: { \
|
case 2: { \
|
||||||
Uint16 Pixel; \
|
Uint16 Pixel; \
|
||||||
\
|
\
|
||||||
|
|
|
@ -2344,8 +2344,8 @@ struct blit_table
|
||||||
{ NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha;
|
{ NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha;
|
||||||
};
|
};
|
||||||
static const struct blit_table normal_blit_1[] = {
|
static const struct blit_table normal_blit_1[] = {
|
||||||
/* Default for 8-bit RGB source, an invalid combination */
|
/* Default for 8-bit RGB source, never optimized */
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, NULL},
|
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct blit_table normal_blit_2[] = {
|
static const struct blit_table normal_blit_2[] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue