Some simplification of previous commit
authorSylvain Becker <sylvain.becker@gmail.com>
Thu, 07 Feb 2019 22:45:50 +0100
changeset 12606dfda346c1a7d
parent 12605 f1374904c775
child 12607 4fb583571d7c
Some simplification of previous commit
src/video/SDL_blit_N.c
     1.1 --- a/src/video/SDL_blit_N.c	Thu Feb 07 22:03:30 2019 +0100
     1.2 +++ b/src/video/SDL_blit_N.c	Thu Feb 07 22:45:50 2019 +0100
     1.3 @@ -2229,7 +2229,7 @@
     1.4      int dstbpp = dstfmt->BytesPerPixel;
     1.5      unsigned alpha = dstfmt->Amask ? info->a : 0;
     1.6  
     1.7 -    /* Any src/dst 8888, no ARGB2101010 */
     1.8 +    /* Any src/dst 8888, not CopyAlpha, no ARGB2101010 */
     1.9      if (srcbpp == 4 && dstbpp == 4 &&
    1.10          srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
    1.11          dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
    1.12 @@ -2297,7 +2297,7 @@
    1.13      int dstbpp = dstfmt->BytesPerPixel;
    1.14      int c;
    1.15  
    1.16 -    /* Any src/dst 8888, no ARGB2101010 */
    1.17 +    /* Any src/dst 8888 for CopyAlpha, no ARGB2101010 */
    1.18      if (srcbpp == 4 && dstbpp == 4 &&
    1.19          srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
    1.20          dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
    1.21 @@ -2521,52 +2521,27 @@
    1.22          int missing = 0, r, g, b, a;
    1.23          get_permutation(srcfmt, dstfmt, &r, &g, &b, &a, &missing);
    1.24  
    1.25 -        if (dstfmt->Amask) {
    1.26 -            while (height--) {
    1.27 -                /* *INDENT-OFF* */
    1.28 -                DUFFS_LOOP(
    1.29 -                {
    1.30 -                    if ((*src32 & rgbmask) != ckey) {
    1.31 -                        Uint8 *s8 = (Uint8 *)src32;
    1.32 -                        Uint8 *d8 = (Uint8 *)dst32;
    1.33 -                        d8[0] = s8[r];
    1.34 -                        d8[1] = s8[g];
    1.35 -                        d8[2] = s8[b];
    1.36 -                        d8[3] = s8[a];
    1.37 -                        d8[missing] = alpha;
    1.38 -                    }
    1.39 -                    ++src32;
    1.40 -                    ++dst32;
    1.41 -                }, width);
    1.42 -                /* *INDENT-ON* */
    1.43 -                src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
    1.44 -                dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
    1.45 -            }
    1.46 -
    1.47 -            return;
    1.48 -        } else {
    1.49 -            while (height--) {
    1.50 -                /* *INDENT-OFF* */
    1.51 -                DUFFS_LOOP(
    1.52 -                {
    1.53 -                    if ((*src32 & rgbmask) != ckey) {
    1.54 -                        Uint8 *s8 = (Uint8 *)src32;
    1.55 -                        Uint8 *d8 = (Uint8 *)dst32;
    1.56 -                        d8[0] = s8[r];
    1.57 -                        d8[1] = s8[g];
    1.58 -                        d8[2] = s8[b];
    1.59 -                        d8[3] = s8[a];
    1.60 -                        d8[missing] = 0;
    1.61 -                    }
    1.62 -                    ++src32;
    1.63 -                    ++dst32;
    1.64 -                }, width);
    1.65 -                /* *INDENT-ON* */
    1.66 -                src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
    1.67 -                dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
    1.68 -            }
    1.69 -            return;
    1.70 +        while (height--) {
    1.71 +            /* *INDENT-OFF* */
    1.72 +            DUFFS_LOOP(
    1.73 +            {
    1.74 +                if ((*src32 & rgbmask) != ckey) {
    1.75 +                    Uint8 *s8 = (Uint8 *)src32;
    1.76 +                    Uint8 *d8 = (Uint8 *)dst32;
    1.77 +                    d8[0] = s8[r];
    1.78 +                    d8[1] = s8[g];
    1.79 +                    d8[2] = s8[b];
    1.80 +                    d8[3] = s8[a];
    1.81 +                    d8[missing] = alpha;
    1.82 +                }
    1.83 +                ++src32;
    1.84 +                ++dst32;
    1.85 +            }, width);
    1.86 +            /* *INDENT-ON* */
    1.87 +            src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
    1.88 +            dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
    1.89          }
    1.90 +        return;
    1.91      }
    1.92  
    1.93      /* BPP 3, same rgb triplet */