Rename SDL_PIXELFORMAT_RGB888 and SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 for clarity
Fixes https://github.com/libsdl-org/SDL/issues/7903
This commit is contained in:
@@ -75,26 +75,26 @@ static int SDL_BlendFillRect_RGB565(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SDL_BlendFillRect_RGB888(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
static int SDL_BlendFillRect_XRGB8888(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
unsigned inva = 0xff - a;
|
||||
|
||||
switch (blendMode) {
|
||||
case SDL_BLENDMODE_BLEND:
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_RGB888);
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_XRGB8888);
|
||||
break;
|
||||
case SDL_BLENDMODE_ADD:
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGB888);
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_ADD_XRGB8888);
|
||||
break;
|
||||
case SDL_BLENDMODE_MOD:
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGB888);
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_MOD_XRGB8888);
|
||||
break;
|
||||
case SDL_BLENDMODE_MUL:
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_MUL_RGB888);
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_MUL_XRGB8888);
|
||||
break;
|
||||
default:
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_RGB888);
|
||||
FILLRECT(Uint32, DRAW_SETPIXEL_XRGB8888);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -254,7 +254,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
switch (dst->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
return SDL_BlendFillRect_RGB888(dst, rect, blendMode, r, g, b, a);
|
||||
return SDL_BlendFillRect_XRGB8888(dst, rect, blendMode, r, g, b, a);
|
||||
} else {
|
||||
return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a);
|
||||
}
|
||||
@@ -314,7 +314,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
switch (dst->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
func = SDL_BlendFillRect_RGB888;
|
||||
func = SDL_BlendFillRect_XRGB8888;
|
||||
} else {
|
||||
func = SDL_BlendFillRect_ARGB8888;
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ static void SDL_BlendLine_RGBA4(SDL_Surface *dst, int x1, int y1, int x2, int y2
|
||||
}
|
||||
}
|
||||
|
||||
static void SDL_BlendLine_RGB888(SDL_Surface *dst, int x1, int y1, int x2, int y2,
|
||||
static void SDL_BlendLine_XRGB8888(SDL_Surface *dst, int x1, int y1, int x2, int y2,
|
||||
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
|
||||
SDL_bool draw_end)
|
||||
{
|
||||
@@ -571,82 +571,82 @@ static void SDL_BlendLine_RGB888(SDL_Surface *dst, int x1, int y1, int x2, int y
|
||||
if (y1 == y2) {
|
||||
switch (blendMode) {
|
||||
case SDL_BLENDMODE_BLEND:
|
||||
HLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
|
||||
HLINE(Uint32, DRAW_SETPIXEL_BLEND_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_ADD:
|
||||
HLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
|
||||
HLINE(Uint32, DRAW_SETPIXEL_ADD_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MOD:
|
||||
HLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
|
||||
HLINE(Uint32, DRAW_SETPIXEL_MOD_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MUL:
|
||||
HLINE(Uint32, DRAW_SETPIXEL_MUL_RGB888, draw_end);
|
||||
HLINE(Uint32, DRAW_SETPIXEL_MUL_XRGB8888, draw_end);
|
||||
break;
|
||||
default:
|
||||
HLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
|
||||
HLINE(Uint32, DRAW_SETPIXEL_XRGB8888, draw_end);
|
||||
break;
|
||||
}
|
||||
} else if (x1 == x2) {
|
||||
switch (blendMode) {
|
||||
case SDL_BLENDMODE_BLEND:
|
||||
VLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
|
||||
VLINE(Uint32, DRAW_SETPIXEL_BLEND_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_ADD:
|
||||
VLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
|
||||
VLINE(Uint32, DRAW_SETPIXEL_ADD_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MOD:
|
||||
VLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
|
||||
VLINE(Uint32, DRAW_SETPIXEL_MOD_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MUL:
|
||||
VLINE(Uint32, DRAW_SETPIXEL_MUL_RGB888, draw_end);
|
||||
VLINE(Uint32, DRAW_SETPIXEL_MUL_XRGB8888, draw_end);
|
||||
break;
|
||||
default:
|
||||
VLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
|
||||
VLINE(Uint32, DRAW_SETPIXEL_XRGB8888, draw_end);
|
||||
break;
|
||||
}
|
||||
} else if (ABS(x1 - x2) == ABS(y1 - y2)) {
|
||||
switch (blendMode) {
|
||||
case SDL_BLENDMODE_BLEND:
|
||||
DLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
|
||||
DLINE(Uint32, DRAW_SETPIXEL_BLEND_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_ADD:
|
||||
DLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
|
||||
DLINE(Uint32, DRAW_SETPIXEL_ADD_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MOD:
|
||||
DLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
|
||||
DLINE(Uint32, DRAW_SETPIXEL_MOD_XRGB8888, draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MUL:
|
||||
DLINE(Uint32, DRAW_SETPIXEL_MUL_RGB888, draw_end);
|
||||
DLINE(Uint32, DRAW_SETPIXEL_MUL_XRGB8888, draw_end);
|
||||
break;
|
||||
default:
|
||||
DLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
|
||||
DLINE(Uint32, DRAW_SETPIXEL_XRGB8888, draw_end);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (blendMode) {
|
||||
case SDL_BLENDMODE_BLEND:
|
||||
AALINE(x1, y1, x2, y2,
|
||||
DRAW_SETPIXELXY_BLEND_RGB888, DRAW_SETPIXELXY_BLEND_RGB888,
|
||||
DRAW_SETPIXELXY_BLEND_XRGB8888, DRAW_SETPIXELXY_BLEND_XRGB8888,
|
||||
draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_ADD:
|
||||
AALINE(x1, y1, x2, y2,
|
||||
DRAW_SETPIXELXY_ADD_RGB888, DRAW_SETPIXELXY_ADD_RGB888,
|
||||
DRAW_SETPIXELXY_ADD_XRGB8888, DRAW_SETPIXELXY_ADD_XRGB8888,
|
||||
draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MOD:
|
||||
AALINE(x1, y1, x2, y2,
|
||||
DRAW_SETPIXELXY_MOD_RGB888, DRAW_SETPIXELXY_MOD_RGB888,
|
||||
DRAW_SETPIXELXY_MOD_XRGB8888, DRAW_SETPIXELXY_MOD_XRGB8888,
|
||||
draw_end);
|
||||
break;
|
||||
case SDL_BLENDMODE_MUL:
|
||||
AALINE(x1, y1, x2, y2,
|
||||
DRAW_SETPIXELXY_MUL_RGB888, DRAW_SETPIXELXY_MUL_RGB888,
|
||||
DRAW_SETPIXELXY_MUL_XRGB8888, DRAW_SETPIXELXY_MUL_XRGB8888,
|
||||
draw_end);
|
||||
break;
|
||||
default:
|
||||
AALINE(x1, y1, x2, y2,
|
||||
DRAW_SETPIXELXY_RGB888, DRAW_SETPIXELXY_BLEND_RGB888,
|
||||
DRAW_SETPIXELXY_XRGB8888, DRAW_SETPIXELXY_BLEND_XRGB8888,
|
||||
draw_end);
|
||||
break;
|
||||
}
|
||||
@@ -780,7 +780,7 @@ static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
|
||||
if (fmt->Amask) {
|
||||
return SDL_BlendLine_ARGB8888;
|
||||
} else {
|
||||
return SDL_BlendLine_RGB888;
|
||||
return SDL_BlendLine_XRGB8888;
|
||||
}
|
||||
} else {
|
||||
if (fmt->Amask) {
|
||||
|
||||
@@ -75,26 +75,26 @@ static int SDL_BlendPoint_RGB565(SDL_Surface *dst, int x, int y, SDL_BlendMode b
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SDL_BlendPoint_RGB888(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
|
||||
static int SDL_BlendPoint_XRGB8888(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
|
||||
Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
unsigned inva = 0xff - a;
|
||||
|
||||
switch (blendMode) {
|
||||
case SDL_BLENDMODE_BLEND:
|
||||
DRAW_SETPIXELXY_BLEND_RGB888(x, y);
|
||||
DRAW_SETPIXELXY_BLEND_XRGB8888(x, y);
|
||||
break;
|
||||
case SDL_BLENDMODE_ADD:
|
||||
DRAW_SETPIXELXY_ADD_RGB888(x, y);
|
||||
DRAW_SETPIXELXY_ADD_XRGB8888(x, y);
|
||||
break;
|
||||
case SDL_BLENDMODE_MOD:
|
||||
DRAW_SETPIXELXY_MOD_RGB888(x, y);
|
||||
DRAW_SETPIXELXY_MOD_XRGB8888(x, y);
|
||||
break;
|
||||
case SDL_BLENDMODE_MUL:
|
||||
DRAW_SETPIXELXY_MUL_RGB888(x, y);
|
||||
DRAW_SETPIXELXY_MUL_XRGB8888(x, y);
|
||||
break;
|
||||
default:
|
||||
DRAW_SETPIXELXY_RGB888(x, y);
|
||||
DRAW_SETPIXELXY_XRGB8888(x, y);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -248,7 +248,7 @@ int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint
|
||||
switch (dst->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, a);
|
||||
return SDL_BlendPoint_XRGB8888(dst, x, y, blendMode, r, g, b, a);
|
||||
} else {
|
||||
return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a);
|
||||
}
|
||||
@@ -312,7 +312,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
switch (dst->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
func = SDL_BlendPoint_RGB888;
|
||||
func = SDL_BlendPoint_XRGB8888;
|
||||
} else {
|
||||
func = SDL_BlendPoint_ARGB8888;
|
||||
}
|
||||
|
||||
@@ -191,39 +191,39 @@
|
||||
* Define draw operators for RGB888
|
||||
*/
|
||||
|
||||
#define DRAW_SETPIXEL_RGB888 \
|
||||
DRAW_SETPIXEL(RGB888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
#define DRAW_SETPIXEL_XRGB8888 \
|
||||
DRAW_SETPIXEL(XRGB8888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
|
||||
#define DRAW_SETPIXEL_BLEND_RGB888 \
|
||||
DRAW_SETPIXEL_BLEND(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
|
||||
RGB888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
#define DRAW_SETPIXEL_BLEND_XRGB8888 \
|
||||
DRAW_SETPIXEL_BLEND(RGB_FROM_XRGB8888(*pixel, sr, sg, sb), \
|
||||
XRGB8888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
|
||||
#define DRAW_SETPIXEL_ADD_RGB888 \
|
||||
DRAW_SETPIXEL_ADD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
|
||||
RGB888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
#define DRAW_SETPIXEL_ADD_XRGB8888 \
|
||||
DRAW_SETPIXEL_ADD(RGB_FROM_XRGB8888(*pixel, sr, sg, sb), \
|
||||
XRGB8888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
|
||||
#define DRAW_SETPIXEL_MOD_RGB888 \
|
||||
DRAW_SETPIXEL_MOD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
|
||||
RGB888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
#define DRAW_SETPIXEL_MOD_XRGB8888 \
|
||||
DRAW_SETPIXEL_MOD(RGB_FROM_XRGB8888(*pixel, sr, sg, sb), \
|
||||
XRGB8888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
|
||||
#define DRAW_SETPIXEL_MUL_RGB888 \
|
||||
DRAW_SETPIXEL_MUL(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
|
||||
RGB888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
#define DRAW_SETPIXEL_MUL_XRGB8888 \
|
||||
DRAW_SETPIXEL_MUL(RGB_FROM_XRGB8888(*pixel, sr, sg, sb), \
|
||||
XRGB8888_FROM_RGB(*pixel, sr, sg, sb))
|
||||
|
||||
#define DRAW_SETPIXELXY_RGB888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_RGB888)
|
||||
#define DRAW_SETPIXELXY_XRGB8888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_XRGB8888)
|
||||
|
||||
#define DRAW_SETPIXELXY_BLEND_RGB888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_RGB888)
|
||||
#define DRAW_SETPIXELXY_BLEND_XRGB8888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_XRGB8888)
|
||||
|
||||
#define DRAW_SETPIXELXY_ADD_RGB888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_RGB888)
|
||||
#define DRAW_SETPIXELXY_ADD_XRGB8888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_XRGB8888)
|
||||
|
||||
#define DRAW_SETPIXELXY_MOD_RGB888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_RGB888)
|
||||
#define DRAW_SETPIXELXY_MOD_XRGB8888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_XRGB8888)
|
||||
|
||||
#define DRAW_SETPIXELXY_MUL_RGB888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MUL_RGB888)
|
||||
#define DRAW_SETPIXELXY_MUL_XRGB8888(x, y) \
|
||||
DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MUL_XRGB8888)
|
||||
|
||||
/*
|
||||
* Define draw operators for ARGB8888
|
||||
|
||||
@@ -98,7 +98,7 @@ static void SDL_DrawLine4(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
|
||||
if (fmt->Rmask == 0x00FF0000) {
|
||||
if (!fmt->Amask) {
|
||||
AALINE(x1, y1, x2, y2,
|
||||
DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY_BLEND_RGB888,
|
||||
DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY_BLEND_XRGB8888,
|
||||
draw_end);
|
||||
} else {
|
||||
AALINE(x1, y1, x2, y2,
|
||||
|
||||
Reference in New Issue
Block a user