1.1 --- a/src/video/SDL_blit_N.c Thu Feb 07 21:49:24 2019 +0100
1.2 +++ b/src/video/SDL_blit_N.c Thu Feb 07 22:03:30 2019 +0100
1.3 @@ -2151,8 +2151,8 @@
1.4
1.5 /* permutation for mapping srcfmt to dstfmt, overloading or not the alpha channel */
1.6 static void
1.7 -get_permutation(SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt,
1.8 - int *_r , int *_g, int *_b, int *_a, int *_missing)
1.9 +get_permutation(SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt,
1.10 + int *_r , int *_g, int *_b, int *_a, int *_missing)
1.11 {
1.12 int missing = 0, r, g, b, a = 0;
1.13 int Pixel = 0x04030201; /* identity permutation */
1.14 @@ -2162,7 +2162,7 @@
1.15 } else {
1.16 RGB_FROM_PIXEL(Pixel, srcfmt, r, g, b);
1.17 }
1.18 -
1.19 +
1.20 if (dstfmt->Amask) {
1.21 if (srcfmt->Amask) {
1.22 PIXEL_FROM_RGBA(Pixel, dstfmt, r, g, b, a);
1.23 @@ -2228,7 +2228,7 @@
1.24 SDL_PixelFormat *dstfmt = info->dst_fmt;
1.25 int dstbpp = dstfmt->BytesPerPixel;
1.26 unsigned alpha = dstfmt->Amask ? info->a : 0;
1.27 -
1.28 +
1.29 /* Any src/dst 8888, no ARGB2101010 */
1.30 if (srcbpp == 4 && dstbpp == 4 &&
1.31 srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
1.32 @@ -2240,7 +2240,7 @@
1.33 /* Find the appropriate permutation */
1.34 int missing = 0, r, g, b, a;
1.35 get_permutation(srcfmt, dstfmt, &r, &g, &b, &a, &missing);
1.36 -
1.37 +
1.38 while (height--) {
1.39 /* *INDENT-OFF* */
1.40 DUFFS_LOOP(
1.41 @@ -2261,7 +2261,7 @@
1.42 }
1.43 return;
1.44 }
1.45 -
1.46 +
1.47 while (height--) {
1.48 /* *INDENT-OFF* */
1.49 DUFFS_LOOP(
1.50 @@ -2297,6 +2297,38 @@
1.51 int dstbpp = dstfmt->BytesPerPixel;
1.52 int c;
1.53
1.54 + /* Any src/dst 8888, no ARGB2101010 */
1.55 + if (srcbpp == 4 && dstbpp == 4 &&
1.56 + srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
1.57 + dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
1.58 +
1.59 + Uint32 *src32 = (Uint32*)src;
1.60 + Uint32 *dst32 = (Uint32*)dst;
1.61 +
1.62 + /* Find the appropriate permutation */
1.63 + int r, g, b, a;
1.64 + get_permutation(srcfmt, dstfmt, &r, &g, &b, &a, NULL);
1.65 +
1.66 + while (height--) {
1.67 + /* *INDENT-OFF* */
1.68 + DUFFS_LOOP(
1.69 + {
1.70 + Uint8 *s8 = (Uint8 *)src32;
1.71 + Uint8 *d8 = (Uint8 *)dst32;
1.72 + d8[0] = s8[r];
1.73 + d8[1] = s8[g];
1.74 + d8[2] = s8[b];
1.75 + d8[3] = s8[a];
1.76 + ++src32;
1.77 + ++dst32;
1.78 + }, width);
1.79 + /* *INDENT-ON* */
1.80 + src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
1.81 + dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
1.82 + }
1.83 + return;
1.84 + }
1.85 +
1.86 while (height--) {
1.87 for (c = width; c; --c) {
1.88 Uint32 Pixel;
1.89 @@ -2484,11 +2516,11 @@
1.90
1.91 Uint32 *src32 = (Uint32*)src;
1.92 Uint32 *dst32 = (Uint32*)dst;
1.93 -
1.94 +
1.95 /* Find the appropriate permutation */
1.96 int missing = 0, r, g, b, a;
1.97 get_permutation(srcfmt, dstfmt, &r, &g, &b, &a, &missing);
1.98 -
1.99 +
1.100 if (dstfmt->Amask) {
1.101 while (height--) {
1.102 /* *INDENT-OFF* */
1.103 @@ -2510,7 +2542,7 @@
1.104 src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
1.105 dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
1.106 }
1.107 -
1.108 +
1.109 return;
1.110 } else {
1.111 while (height--) {