diff -r e0e2e94ce5ea src/video/SDL_blit_N.c --- a/src/video/SDL_blit_N.c Fri May 01 01:20:28 2015 -0400 +++ b/src/video/SDL_blit_N.c Mon May 04 17:19:23 2015 +0800 @@ -2114,6 +2114,33 @@ } } +/* blits 32 bit RGBA<->RGBA with both surfaces having the same R,G,B,A fields */ +static void +Blit4to4CopyAlpha(SDL_BlitInfo * info) +{ + int width = info->dst_w; + int height = info->dst_h; + Uint32 *src = (Uint32 *) info->src; + int srcskip = info->src_skip; + Uint32 *dst = (Uint32 *) info->dst; + int dstskip = info->dst_skip; + + /* RGBA->RGBA, COPY_ALPHA */ + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + *dst = *src; + ++dst; + ++src; + }, + width); + /* *INDENT-ON* */ + src = (Uint32 *) ((Uint8 *) src + srcskip); + dst = (Uint32 *) ((Uint8 *) dst + dstskip); + } +} + static void BlitNtoN(SDL_BlitInfo * info) { @@ -2562,8 +2589,17 @@ srcfmt->Rmask == dstfmt->Rmask && srcfmt->Gmask == dstfmt->Gmask && srcfmt->Bmask == dstfmt->Bmask) { - /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */ - blitfun = Blit4to4MaskAlpha; + if (a_need == COPY_ALPHA) { + if (srcfmt->Amask == dstfmt->Amask) { + /* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */ + blitfun = Blit4to4CopyAlpha; + } else { + blitfun = BlitNtoNCopyAlpha; + } + } else { + /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */ + blitfun = Blit4to4MaskAlpha; + } } else if (a_need == COPY_ALPHA) { blitfun = BlitNtoNCopyAlpha; }