Some simplification of previous commit

Sylvain Becker 2019-02-07 22:45:50 +01:00
parent 5fd228921c
commit 5ed30f844d
1 changed files with 22 additions and 47 deletions

View File

@ -2229,7 +2229,7 @@ BlitNtoN(SDL_BlitInfo * info)
int dstbpp = dstfmt->BytesPerPixel; int dstbpp = dstfmt->BytesPerPixel;
unsigned alpha = dstfmt->Amask ? info->a : 0; unsigned alpha = dstfmt->Amask ? info->a : 0;
/* Any src/dst 8888, no ARGB2101010 */ /* Any src/dst 8888, not CopyAlpha, no ARGB2101010 */
if (srcbpp == 4 && dstbpp == 4 && if (srcbpp == 4 && dstbpp == 4 &&
srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 && srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
@ -2297,7 +2297,7 @@ BlitNtoNCopyAlpha(SDL_BlitInfo * info)
int dstbpp = dstfmt->BytesPerPixel; int dstbpp = dstfmt->BytesPerPixel;
int c; int c;
/* Any src/dst 8888, no ARGB2101010 */ /* Any src/dst 8888 for CopyAlpha, no ARGB2101010 */
if (srcbpp == 4 && dstbpp == 4 && if (srcbpp == 4 && dstbpp == 4 &&
srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 && srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
@ -2521,52 +2521,27 @@ BlitNtoNKey(SDL_BlitInfo * info)
int missing = 0, r, g, b, a; int missing = 0, r, g, b, a;
get_permutation(srcfmt, dstfmt, &r, &g, &b, &a, &missing); get_permutation(srcfmt, dstfmt, &r, &g, &b, &a, &missing);
if (dstfmt->Amask) { while (height--) {
while (height--) { /* *INDENT-OFF* */
/* *INDENT-OFF* */ DUFFS_LOOP(
DUFFS_LOOP( {
{ if ((*src32 & rgbmask) != ckey) {
if ((*src32 & rgbmask) != ckey) { Uint8 *s8 = (Uint8 *)src32;
Uint8 *s8 = (Uint8 *)src32; Uint8 *d8 = (Uint8 *)dst32;
Uint8 *d8 = (Uint8 *)dst32; d8[0] = s8[r];
d8[0] = s8[r]; d8[1] = s8[g];
d8[1] = s8[g]; d8[2] = s8[b];
d8[2] = s8[b]; d8[3] = s8[a];
d8[3] = s8[a]; d8[missing] = alpha;
d8[missing] = alpha; }
} ++src32;
++src32; ++dst32;
++dst32; }, width);
}, width); /* *INDENT-ON* */
/* *INDENT-ON* */ src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
src32 = (Uint32 *)((Uint8 *)src32 + srcskip); dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
}
return;
} else {
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
if ((*src32 & rgbmask) != ckey) {
Uint8 *s8 = (Uint8 *)src32;
Uint8 *d8 = (Uint8 *)dst32;
d8[0] = s8[r];
d8[1] = s8[g];
d8[2] = s8[b];
d8[3] = s8[a];
d8[missing] = 0;
}
++src32;
++dst32;
}, width);
/* *INDENT-ON* */
src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
}
return;
} }
return;
} }
/* BPP 3, same rgb triplet */ /* BPP 3, same rgb triplet */