|
@@ -1222,10 +1222,9 @@ static void BlitARGBto565PixelAlpha(SDL_BlitInfo *info)
|
|
|
DUFFS_LOOP4({
|
|
|
Uint32 s = *srcp;
|
|
|
unsigned alpha = s >> 27; /* downscale alpha to 5 bits */
|
|
|
- /* FIXME: Here we special-case opaque alpha since the
|
|
|
+ /* Here we special-case opaque alpha since the
|
|
|
compositioning used (>>8 instead of /255) doesn't handle
|
|
|
- it correctly. Also special-case alpha=0 for speed?
|
|
|
- Benchmark this! */
|
|
|
+ it correctly. */
|
|
|
if (alpha) {
|
|
|
if (alpha == (SDL_ALPHA_OPAQUE >> 3)) {
|
|
|
*dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f));
|
|
@@ -1235,8 +1234,7 @@ static void BlitARGBto565PixelAlpha(SDL_BlitInfo *info)
|
|
|
* convert source and destination to G0RAB65565
|
|
|
* and blend all components at the same time
|
|
|
*/
|
|
|
- s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800)
|
|
|
- + (s >> 3 & 0x1f);
|
|
|
+ s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800) + (s >> 3 & 0x1f);
|
|
|
d = (d | d << 16) & 0x07e0f81f;
|
|
|
d += (s - d) * alpha >> 5;
|
|
|
d &= 0x07e0f81f;
|
|
@@ -1268,21 +1266,19 @@ static void BlitARGBto555PixelAlpha(SDL_BlitInfo *info)
|
|
|
unsigned alpha;
|
|
|
Uint32 s = *srcp;
|
|
|
alpha = s >> 27; /* downscale alpha to 5 bits */
|
|
|
- /* FIXME: Here we special-case opaque alpha since the
|
|
|
+ /* Here we special-case opaque alpha since the
|
|
|
compositioning used (>>8 instead of /255) doesn't handle
|
|
|
- it correctly. Also special-case alpha=0 for speed?
|
|
|
- Benchmark this! */
|
|
|
+ it correctly. */
|
|
|
if (alpha) {
|
|
|
if (alpha == (SDL_ALPHA_OPAQUE >> 3)) {
|
|
|
*dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f));
|
|
|
} else {
|
|
|
Uint32 d = *dstp;
|
|
|
/*
|
|
|
- * convert source and destination to G0RAB65565
|
|
|
+ * convert source and destination to G0RAB55555
|
|
|
* and blend all components at the same time
|
|
|
*/
|
|
|
- s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00)
|
|
|
- + (s >> 3 & 0x1f);
|
|
|
+ s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00) + (s >> 3 & 0x1f);
|
|
|
d = (d | d << 16) & 0x03e07c1f;
|
|
|
d += (s - d) * alpha >> 5;
|
|
|
d &= 0x03e07c1f;
|
|
@@ -1452,7 +1448,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
|
|
if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
|
|
|
if (df->Gmask == 0x7e0) {
|
|
|
return BlitARGBto565PixelAlpha;
|
|
|
- } else if (df->Gmask == 0x3e0) {
|
|
|
+ } else if (df->Gmask == 0x3e0 && !df->Amask) {
|
|
|
return BlitARGBto555PixelAlpha;
|
|
|
}
|
|
|
}
|