From f353179370f9d086005108741f97f1a7b698d621 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 29 Nov 2008 00:08:29 +0000 Subject: [PATCH] Added ARGB8888 destination format (used on Mac OS X) --- src/video/SDL_blit_auto.c | 3063 ++++++++++++++++++++++++++++++++++--- src/video/sdlgenblit.pl | 8 +- 2 files changed, 2867 insertions(+), 204 deletions(-) diff --git a/src/video/SDL_blit_auto.c b/src/video/SDL_blit_auto.c index 2ce5862fc..85d2a403c 100644 --- a/src/video/SDL_blit_auto.c +++ b/src/video/SDL_blit_auto.c @@ -897,7 +897,7 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -930,8 +930,8 @@ static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -941,7 +941,7 @@ static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -955,9 +955,9 @@ static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -990,7 +990,7 @@ static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -1000,7 +1000,7 @@ static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -1035,9 +1035,9 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -1070,7 +1070,7 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -1080,7 +1080,7 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1096,7 +1096,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { pixel = *src; - B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -1105,7 +1105,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; ++src; ++dst; @@ -1115,7 +1115,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1152,7 +1152,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -1161,7 +1161,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -1171,7 +1171,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1189,9 +1189,9 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -1232,7 +1232,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -1242,7 +1242,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1281,9 +1281,9 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -1324,7 +1324,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -1334,9 +1334,11 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; + Uint32 pixel; + Uint32 R, G, B, A; int srcy, srcx; int posy, posx; int incy, incx; @@ -1364,7 +1366,10 @@ static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) } src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } - *dst = *src; + pixel = *src; + B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; posx += incx; ++dst; } @@ -1373,7 +1378,7 @@ static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -1389,7 +1394,7 @@ static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -1422,7 +1427,7 @@ static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -1432,7 +1437,7 @@ static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -1469,7 +1474,7 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -1502,7 +1507,7 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -1512,7 +1517,7 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1537,7 +1542,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; ++src; ++dst; @@ -1547,7 +1552,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1593,7 +1598,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -1603,7 +1608,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1623,7 +1628,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -1664,7 +1669,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -1674,7 +1679,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1715,7 +1720,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -1756,7 +1761,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -1766,11 +1771,9 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; - Uint32 pixel; - Uint32 R, G, B, A; int srcy, srcx; int posy, posx; int incy, incx; @@ -1798,9 +1801,2623 @@ static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) } src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } + *dst = *src; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { pixel = *src; - A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + *dst = pixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + pixel = *src; + B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + *dst = pixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + *dst = *src; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_ARGB8888_Modulate(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + dstpixel = *dst; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + pixel = *src; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + if (flags & SDL_COPY_MODULATE_COLOR) { + R = (R * modulateR) / 255; + G = (G * modulateG) / 255; + B = (B * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + A = (A * modulateA) / 255; + } + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + *dst = pixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + + while (info->dst_h--) { + Uint32 *src = (Uint32 *)info->src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + while (n--) { + srcpixel = *src; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + ++src; + ++dst; + } + info->src += info->src_pitch; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + const Uint32 modulateR = info->r; + const Uint32 modulateG = info->g; + const Uint32 modulateB = info->b; + const Uint32 modulateA = info->a; + Uint32 srcpixel; + Uint32 srcR, srcG, srcB, srcA; + Uint32 dstpixel; + Uint32 dstR, dstG, dstB, dstA; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + srcpixel = *src; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + dstpixel = *dst; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + if (flags & SDL_COPY_MODULATE_COLOR) { + srcR = (srcR * modulateR) / 255; + srcG = (srcG * modulateG) / 255; + srcB = (srcB * modulateB) / 255; + } + if (flags & SDL_COPY_MODULATE_ALPHA) { + srcA = (srcA * modulateA) / 255; + } + if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { + /* This goes away if we ever use premultiplied alpha */ + if (srcA < 255) { + srcR = (srcR * srcA) / 255; + srcG = (srcG * srcA) / 255; + srcB = (srcB * srcA) / 255; + } + } + switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { + case SDL_COPY_MASK: + if (srcA) { + dstR = srcR; + dstG = srcG; + dstB = srcB; + } + break; + case SDL_COPY_BLEND: + dstR = srcR + ((255 - srcA) * dstR) / 255; + dstG = srcG + ((255 - srcA) * dstG) / 255; + dstB = srcB + ((255 - srcA) * dstB) / 255; + break; + case SDL_COPY_ADD: + dstR = srcR + dstR; if (dstR > 255) dstR = 255; + dstG = srcG + dstG; if (dstG > 255) dstG = 255; + dstB = srcB + dstB; if (dstB > 255) dstB = 255; + break; + case SDL_COPY_MOD: + dstR = (srcR * dstR) / 255; + dstG = (srcG * dstG) / 255; + dstB = (srcB * dstB) / 255; + break; + } + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + *dst = dstpixel; + posx += incx; + ++dst; + } + posy += incy; + info->dst += info->dst_pitch; + } +} + +static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) +{ + const int flags = info->flags; + Uint32 pixel; + Uint32 R, G, B, A; + int srcy, srcx; + int posy, posx; + int incy, incx; + + srcy = 0; + posy = 0; + incy = (info->src_h << 16) / info->dst_h; + incx = (info->src_w << 16) / info->dst_w; + + while (info->dst_h--) { + Uint32 *src; + Uint32 *dst = (Uint32 *)info->dst; + int n = info->dst_w; + srcx = -1; + posx = 0x10000L; + while (posy >= 0x10000L) { + ++srcy; + posy -= 0x10000L; + } + while (n--) { + if (posx >= 0x10000L) { + while (posx >= 0x10000L) { + ++srcx; + posx -= 0x10000L; + } + src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); + } + pixel = *src; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; *dst = pixel; posx += incx; ++dst; @@ -1810,7 +4427,7 @@ static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -1824,9 +4441,9 @@ static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -1859,7 +4476,7 @@ static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; ++src; ++dst; @@ -1869,7 +4486,7 @@ static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -1904,9 +4521,9 @@ static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -1939,7 +4556,7 @@ static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; posx += incx; ++dst; @@ -1949,7 +4566,7 @@ static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -1965,7 +4582,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { pixel = *src; - A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -1974,7 +4591,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; *dst = pixel; ++src; ++dst; @@ -1984,7 +4601,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2021,7 +4638,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -2030,7 +4647,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; *dst = pixel; posx += incx; ++dst; @@ -2040,7 +4657,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2058,9 +4675,9 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -2101,7 +4718,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; ++src; ++dst; @@ -2111,7 +4728,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2150,9 +4767,9 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -2193,7 +4810,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; posx += incx; ++dst; @@ -2203,7 +4820,7 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -2236,8 +4853,8 @@ static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -2247,7 +4864,7 @@ static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -2261,9 +4878,9 @@ static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -2296,7 +4913,7 @@ static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -2306,7 +4923,7 @@ static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -2341,9 +4958,9 @@ static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -2376,7 +4993,7 @@ static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -2386,7 +5003,7 @@ static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_ARGB8888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2402,7 +5019,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { pixel = *src; - A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -2411,7 +5028,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; ++src; ++dst; @@ -2421,7 +5038,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2458,7 +5075,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -2467,7 +5084,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -2477,7 +5094,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2495,9 +5112,9 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -2538,7 +5155,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -2548,7 +5165,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2587,9 +5204,9 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; + srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -2630,7 +5247,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -2640,7 +5257,7 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -2673,7 +5290,7 @@ static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; @@ -2684,7 +5301,7 @@ static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -2698,7 +5315,7 @@ static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { @@ -2743,7 +5360,7 @@ static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -2778,7 +5395,7 @@ static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { @@ -2823,7 +5440,7 @@ static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2839,7 +5456,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -2858,7 +5475,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2895,7 +5512,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -2914,7 +5531,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -2932,7 +5549,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { @@ -2985,7 +5602,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3024,7 +5641,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { @@ -3077,7 +5694,7 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -3110,7 +5727,7 @@ static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; *dst = pixel; posx += incx; @@ -3121,7 +5738,7 @@ static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -3135,7 +5752,7 @@ static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { @@ -3180,7 +5797,7 @@ static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -3215,7 +5832,7 @@ static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { @@ -3260,7 +5877,7 @@ static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3276,7 +5893,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -3295,7 +5912,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3332,7 +5949,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -3351,7 +5968,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3369,7 +5986,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { @@ -3422,7 +6039,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3461,7 +6078,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; + srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { @@ -3514,7 +6131,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -3548,7 +6165,7 @@ static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) } pixel = *src; A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -3558,7 +6175,7 @@ static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -3574,7 +6191,7 @@ static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) srcpixel = *src; srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -3607,7 +6224,7 @@ static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -3617,7 +6234,7 @@ static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -3654,7 +6271,7 @@ static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -3687,7 +6304,7 @@ static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -3697,7 +6314,7 @@ static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_ARGB8888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3722,7 +6339,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; ++src; ++dst; @@ -3732,7 +6349,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3778,7 +6395,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -3788,7 +6405,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3808,7 +6425,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) srcpixel = *src; srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -3849,7 +6466,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -3859,7 +6476,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -3900,7 +6517,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -3941,7 +6558,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -3951,7 +6568,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -3984,8 +6601,8 @@ static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -3995,7 +6612,7 @@ static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -4009,9 +6626,9 @@ static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; + srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -4044,7 +6661,7 @@ static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -4054,7 +6671,7 @@ static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -4089,9 +6706,9 @@ static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; + srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -4124,7 +6741,7 @@ static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -4134,7 +6751,7 @@ static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4150,7 +6767,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { pixel = *src; - A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; + B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -4159,7 +6776,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; ++src; ++dst; @@ -4169,7 +6786,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4206,7 +6823,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } pixel = *src; - A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; + B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; if (flags & SDL_COPY_MODULATE_COLOR) { R = (R * modulateR) / 255; G = (G * modulateG) / 255; @@ -4215,7 +6832,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -4225,7 +6842,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4243,9 +6860,9 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) int n = info->dst_w; while (n--) { srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; + srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -4286,7 +6903,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -4296,7 +6913,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4335,9 +6952,9 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); } srcpixel = *src; - srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; + srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -4378,7 +6995,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -4388,7 +7005,7 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -4422,7 +7039,7 @@ static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) } pixel = *src; B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; *dst = pixel; posx += incx; ++dst; @@ -4432,7 +7049,7 @@ static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -4448,7 +7065,7 @@ static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -4481,7 +7098,7 @@ static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; ++src; ++dst; @@ -4491,7 +7108,7 @@ static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -4528,7 +7145,7 @@ static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -4561,7 +7178,7 @@ static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; posx += incx; ++dst; @@ -4571,7 +7188,7 @@ static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4596,7 +7213,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; *dst = pixel; ++src; ++dst; @@ -4606,7 +7223,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4652,7 +7269,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; + pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; *dst = pixel; posx += incx; ++dst; @@ -4662,7 +7279,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4682,7 +7299,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -4723,7 +7340,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; ++src; ++dst; @@ -4733,7 +7350,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -4774,7 +7391,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; + dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -4815,7 +7432,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; + dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; *dst = dstpixel; posx += incx; ++dst; @@ -4825,7 +7442,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 pixel; @@ -4859,7 +7476,7 @@ static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) } pixel = *src; B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -4869,7 +7486,7 @@ static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -4885,7 +7502,7 @@ static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -4918,7 +7535,7 @@ static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -4928,7 +7545,7 @@ static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; Uint32 srcpixel; @@ -4965,7 +7582,7 @@ static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { @@ -4998,7 +7615,7 @@ static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -5008,7 +7625,7 @@ static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_ARGB8888_Modulate(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -5033,7 +7650,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; ++src; ++dst; @@ -5043,7 +7660,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -5089,7 +7706,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) if (flags & SDL_COPY_MODULATE_ALPHA) { A = (A * modulateA) / 255; } - pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; + pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -5099,7 +7716,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -5119,7 +7736,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -5160,7 +7777,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; ++src; ++dst; @@ -5170,7 +7787,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) } } -static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) +static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) { const int flags = info->flags; const Uint32 modulateR = info->r; @@ -5211,7 +7828,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) srcpixel = *src; srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; dstpixel = *dst; - dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; + dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; if (flags & SDL_COPY_MODULATE_COLOR) { srcR = (srcR * modulateR) / 255; srcG = (srcG * modulateG) / 255; @@ -5252,7 +7869,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) dstB = (srcB * dstB) / 255; break; } - dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; + dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; *dst = dstpixel; posx += incx; ++dst; @@ -5277,6 +7894,13 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale }, { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend }, { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale }, + { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale }, { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend }, { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale }, @@ -5291,6 +7915,13 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale }, { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend }, { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale }, + { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale }, @@ -5305,6 +7936,13 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale }, @@ -5319,6 +7957,13 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale }, @@ -5333,6 +7978,13 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale }, @@ -5347,6 +7999,13 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale }, { 0, 0, 0, 0, NULL } }; diff --git a/src/video/sdlgenblit.pl b/src/video/sdlgenblit.pl index c0c8988d3..d68361e67 100755 --- a/src/video/sdlgenblit.pl +++ b/src/video/sdlgenblit.pl @@ -38,6 +38,7 @@ my @dst_formats = ( "RGB888", "BGR888", + "ARGB8888", ); my %format_size = ( @@ -60,8 +61,7 @@ my %get_rgba_string = ( "RGB888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel; _A = 0xFF;", - "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel; _A = 0xFF;", - "ARGB8888" => "_A = (Uint8)(_pixel >> 24); _R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;", + "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel; _A = 0xFF;", "ARGB8888" => "_A = (Uint8)(_pixel >> 24); _R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;", "RGBA8888" => "_R = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _B = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;", "ABGR8888" => "_A = (Uint8)(_pixel >> 24); _B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;", "BGRA8888" => "_B = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _R = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;", @@ -70,6 +70,10 @@ my %set_rgba_string = ( "RGB888" => "_pixel = ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;", "BGR888" => "_pixel = ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;", + "ARGB8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;", + "RGBA8888" => "_pixel = ((Uint32)_R << 24) | ((Uint32)_G << 16) | ((Uint32)_B << 8) | _A;", + "ABGR8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;", + "BGRA8888" => "_pixel = ((Uint32)_B << 24) | ((Uint32)_G << 16) | ((Uint32)_R << 8) | _A;", ); sub open_file {