Fix formatting

This commit is contained in:
Isaac Aronson
2023-10-10 08:52:17 -05:00
committed by Sam Lantinga
parent 8e3afd56f5
commit 8d099d8976

View File

@@ -965,32 +965,32 @@ static void BlitARGBto565PixelAlpha(SDL_BlitInfo *info)
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* clang-format off */ /* *INDENT-OFF* */ /* clang-format off */
DUFFS_LOOP4({ DUFFS_LOOP4({
Uint32 s = *srcp; Uint32 s = *srcp;
unsigned alpha = s >> 27; /* downscale alpha to 5 bits */ unsigned alpha = s >> 27; /* downscale alpha to 5 bits */
/* FIXME: Here we special-case opaque alpha since the /* FIXME: Here we special-case opaque alpha since the
compositioning used (>>8 instead of /255) doesn't handle compositioning used (>>8 instead of /255) doesn't handle
it correctly. Also special-case alpha=0 for speed? it correctly. Also special-case alpha=0 for speed?
Benchmark this! */ Benchmark this! */
if (alpha) { if (alpha) {
if (alpha == (SDL_ALPHA_OPAQUE >> 3)) { if (alpha == (SDL_ALPHA_OPAQUE >> 3)) {
*dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f)); *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f));
} else { } else {
Uint32 d = *dstp; Uint32 d = *dstp;
/* /*
* convert source and destination to G0RAB65565 * convert source and destination to G0RAB65565
* and blend all components at the same time * and blend all components at the same time
*/ */
s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800) s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800)
+ (s >> 3 & 0x1f); + (s >> 3 & 0x1f);
d = (d | d << 16) & 0x07e0f81f; d = (d | d << 16) & 0x07e0f81f;
d += (s - d) * alpha >> 5; d += (s - d) * alpha >> 5;
d &= 0x07e0f81f; d &= 0x07e0f81f;
*dstp = (Uint16)(d | d >> 16); *dstp = (Uint16)(d | d >> 16);
} }
} }
srcp++; srcp++;
dstp++; dstp++;
}, width); }, width);
/* *INDENT-ON* */ /* clang-format on */ /* *INDENT-ON* */ /* clang-format on */
srcp += srcskip; srcp += srcskip;
dstp += dstskip; dstp += dstskip;
@@ -1010,33 +1010,33 @@ static void BlitARGBto555PixelAlpha(SDL_BlitInfo *info)
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* clang-format off */ /* *INDENT-OFF* */ /* clang-format off */
DUFFS_LOOP4({ DUFFS_LOOP4({
unsigned alpha; unsigned alpha;
Uint32 s = *srcp; Uint32 s = *srcp;
alpha = s >> 27; /* downscale alpha to 5 bits */ alpha = s >> 27; /* downscale alpha to 5 bits */
/* FIXME: Here we special-case opaque alpha since the /* FIXME: Here we special-case opaque alpha since the
compositioning used (>>8 instead of /255) doesn't handle compositioning used (>>8 instead of /255) doesn't handle
it correctly. Also special-case alpha=0 for speed? it correctly. Also special-case alpha=0 for speed?
Benchmark this! */ Benchmark this! */
if (alpha) { if (alpha) {
if (alpha == (SDL_ALPHA_OPAQUE >> 3)) { if (alpha == (SDL_ALPHA_OPAQUE >> 3)) {
*dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f)); *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f));
} else { } else {
Uint32 d = *dstp; Uint32 d = *dstp;
/* /*
* convert source and destination to G0RAB65565 * convert source and destination to G0RAB65565
* and blend all components at the same time * and blend all components at the same time
*/ */
s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00) s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00)
+ (s >> 3 & 0x1f); + (s >> 3 & 0x1f);
d = (d | d << 16) & 0x03e07c1f; d = (d | d << 16) & 0x03e07c1f;
d += (s - d) * alpha >> 5; d += (s - d) * alpha >> 5;
d &= 0x03e07c1f; d &= 0x03e07c1f;
*dstp = (Uint16)(d | d >> 16); *dstp = (Uint16)(d | d >> 16);
} }
} }
srcp++; srcp++;
dstp++; dstp++;
}, width); }, width);
/* *INDENT-ON* */ /* clang-format on */ /* *INDENT-ON* */ /* clang-format on */
srcp += srcskip; srcp += srcskip;
dstp += dstskip; dstp += dstskip;