Static analysis fix: clean up unused variables and dead stores in blitters.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 20 Mar 2014 17:55:24 -0400
changeset 8659 d3a9836732ea
parent 8658 7939f33e81ac
child 8660 6bd1f8bad873
Static analysis fix: clean up unused variables and dead stores in blitters.
src/video/SDL_blit_auto.c
src/video/sdlgenblit.pl
--- a/src/video/SDL_blit_auto.c	Thu Mar 20 17:00:33 2014 -0400
+++ b/src/video/SDL_blit_auto.c	Thu Mar 20 17:55:24 2014 -0400
@@ -201,6 +201,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -208,15 +210,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             ++src;
@@ -239,6 +238,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -264,15 +265,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -294,6 +292,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -362,6 +361,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -441,6 +441,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -466,7 +467,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -613,6 +614,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -620,15 +623,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             ++src;
@@ -651,6 +651,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -676,15 +678,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -706,6 +705,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -774,6 +774,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -853,6 +854,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -905,7 +907,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -979,7 +981,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -1025,6 +1027,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -1063,6 +1067,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -1118,6 +1124,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -1127,7 +1134,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -1186,6 +1193,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -1213,7 +1221,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -1265,6 +1273,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -1290,7 +1299,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -1437,6 +1446,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -1444,15 +1455,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             ++src;
@@ -1475,6 +1483,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -1500,15 +1510,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -1530,6 +1537,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -1598,6 +1606,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -1844,6 +1853,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -1851,15 +1862,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             ++src;
@@ -1882,6 +1890,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -1907,15 +1917,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -1937,6 +1944,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -2005,6 +2013,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2084,6 +2093,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2136,7 +2146,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -2210,7 +2220,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -2256,6 +2266,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -2294,6 +2306,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2349,6 +2363,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -2358,7 +2373,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -2417,6 +2432,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2444,7 +2460,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -2496,6 +2512,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2521,7 +2538,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -2546,7 +2563,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -2620,7 +2637,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -2668,6 +2685,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -2675,15 +2694,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             ++src;
@@ -2706,6 +2722,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2731,15 +2749,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -2761,6 +2776,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -2768,7 +2784,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -2829,6 +2845,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2854,7 +2871,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -2908,6 +2925,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -2933,7 +2951,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -2958,7 +2976,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -3032,7 +3050,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -3080,6 +3098,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -3087,15 +3107,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             ++src;
@@ -3118,6 +3135,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -3143,15 +3162,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -3173,6 +3189,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -3180,7 +3197,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -3241,6 +3258,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -3266,7 +3284,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -3365,9 +3383,9 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -3439,9 +3457,9 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -3487,6 +3505,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -3494,7 +3514,7 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
@@ -3525,6 +3545,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -3550,7 +3572,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
@@ -3580,6 +3602,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -3587,9 +3610,9 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -3648,6 +3671,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -3673,9 +3697,9 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
+            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -3727,6 +3751,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -3752,7 +3777,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -3899,6 +3924,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -3906,15 +3933,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             ++src;
@@ -3937,6 +3961,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -3962,15 +3988,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -3992,6 +4015,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -4060,6 +4084,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4139,6 +4164,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4164,7 +4190,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -4311,6 +4337,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -4318,15 +4346,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             ++src;
@@ -4349,6 +4374,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4374,15 +4401,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -4404,6 +4428,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -4472,6 +4497,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4551,6 +4577,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4603,7 +4630,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -4677,7 +4704,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -4723,6 +4750,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -4761,6 +4790,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4816,6 +4847,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -4825,7 +4857,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -4884,6 +4916,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4911,7 +4944,7 @@
             srcpixel = *src;
             srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -4963,6 +4996,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -4988,7 +5022,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -5013,7 +5047,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -5087,7 +5121,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -5135,6 +5169,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -5142,15 +5178,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             ++src;
@@ -5173,6 +5206,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -5198,15 +5233,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -5228,6 +5260,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -5235,7 +5268,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -5296,6 +5329,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -5321,7 +5355,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -5375,6 +5409,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -5400,7 +5435,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -5425,7 +5460,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -5499,7 +5534,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
@@ -5547,6 +5582,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -5554,15 +5591,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             ++src;
@@ -5585,6 +5619,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -5610,15 +5646,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -5640,6 +5673,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -5647,7 +5681,7 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -5708,6 +5742,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -5733,7 +5768,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
             dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
             if (flags & SDL_COPY_MODULATE_COLOR) {
@@ -5787,6 +5822,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -5812,7 +5848,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
             pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -5837,9 +5873,9 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -5911,9 +5947,9 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -5959,6 +5995,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -5966,7 +6004,7 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
@@ -5997,6 +6035,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -6022,7 +6062,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
@@ -6052,6 +6092,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -6059,9 +6100,9 @@
         int n = info->dst_w;
         while (n--) {
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -6120,6 +6161,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -6145,9 +6187,9 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             srcpixel = *src;
-            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
+            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -6199,6 +6241,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -6224,7 +6267,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -6371,6 +6414,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -6378,15 +6423,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             ++src;
@@ -6409,6 +6451,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -6434,15 +6478,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
             *dst = pixel;
             posx += incx;
@@ -6464,6 +6505,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -6532,6 +6574,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -6611,6 +6654,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -6636,7 +6680,7 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -6783,6 +6827,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -6790,15 +6836,12 @@
         int n = info->dst_w;
         while (n--) {
             pixel = *src;
-            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             ++src;
@@ -6821,6 +6864,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -6846,15 +6891,12 @@
                 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
             }
             pixel = *src;
-            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 R = (R * modulateR) / 255;
                 G = (G * modulateG) / 255;
                 B = (B * modulateB) / 255;
             }
-            if (flags & SDL_COPY_MODULATE_ALPHA) {
-                A = (A * modulateA) / 255;
-            }
             pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
             *dst = pixel;
             posx += incx;
@@ -6876,6 +6918,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -6944,6 +6987,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -7023,6 +7067,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -7075,7 +7120,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -7149,7 +7194,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
                 /* This goes away if we ever use premultiplied alpha */
                 if (srcA < 255) {
@@ -7195,6 +7240,8 @@
     const Uint32 modulateA = info->a;
     Uint32 pixel;
     Uint32 R, G, B, A;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -7233,6 +7280,8 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) A;  /* not all formats use alpha. */
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -7288,6 +7337,7 @@
     Uint32 srcR, srcG, srcB, srcA;
     Uint32 dstpixel;
     Uint32 dstR, dstG, dstB, dstA;
+    (void) modulateA;  /* not all formats use alpha. */
 
     while (info->dst_h--) {
         Uint32 *src = (Uint32 *)info->src;
@@ -7297,7 +7347,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
@@ -7356,6 +7406,7 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+    (void) modulateA;  /* not all formats use alpha. */
 
     srcy = 0;
     posy = 0;
@@ -7383,7 +7434,7 @@
             srcpixel = *src;
             srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
             dstpixel = *dst;
-            dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
             if (flags & SDL_COPY_MODULATE_COLOR) {
                 srcR = (srcR * modulateR) / 255;
                 srcG = (srcG * modulateG) / 255;
--- a/src/video/sdlgenblit.pl	Thu Mar 20 17:00:33 2014 -0400
+++ b/src/video/sdlgenblit.pl	Thu Mar 20 17:55:24 2014 -0400
@@ -58,12 +58,22 @@
     "BGRA8888" => "Uint32",
 );
 
+my %get_rgba_string_ignore_alpha = (
+    "RGB888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;",
+    "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;",
+    "ARGB8888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;",
+    "RGBA8888" => "_R = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _B = (Uint8)(_pixel >> 8);",
+    "ABGR8888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;",
+    "BGRA8888" => "_B = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _R = (Uint8)(_pixel >> 8);",
+);
+
 my %get_rgba_string = (
-    "RGB888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel; _A = 0xFF;",
-    "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel; _A = 0xFF;", "ARGB8888" => "_A = (Uint8)(_pixel >> 24); _R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;",
-    "RGBA8888" => "_R = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _B = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;",
-    "ABGR8888" => "_A = (Uint8)(_pixel >> 24); _B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;",
-    "BGRA8888" => "_B = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _R = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;",
+    "RGB888" => $get_rgba_string_ignore_alpha{"RGB888"} . " _A = 0xFF;",
+    "BGR888" => $get_rgba_string_ignore_alpha{"BGR888"} . " _A = 0xFF;",
+    "ARGB8888" => $get_rgba_string_ignore_alpha{"ARGB8888"} . " _A = (Uint8)(_pixel >> 24);",
+    "RGBA8888" => $get_rgba_string_ignore_alpha{"RGBA8888"} . " _A = (Uint8)_pixel;",
+    "ABGR8888" => $get_rgba_string_ignore_alpha{"ABGR8888"} . " _A = (Uint8)(_pixel >> 24);",
+    "BGRA8888" => $get_rgba_string_ignore_alpha{"BGRA8888"} . " _A = (Uint8)_pixel;",
 );
 
 my %set_rgba_string = (
@@ -160,7 +170,15 @@
 {
     my $prefix = shift;
     my $format = shift;
-    my $string = $get_rgba_string{$format};
+    my $ignore_alpha = shift;
+
+    my $string;
+    if ($ignore_alpha) {
+        $string = $get_rgba_string_ignore_alpha{$format};
+    } else {
+        $string = $get_rgba_string{$format};
+    }
+
     $string =~ s/_/$prefix/g;
     if ( $prefix ne "" ) {
         print FILE <<__EOF__;
@@ -196,6 +214,7 @@
     my $blend = shift;
     my $s = "";
     my $d = "";
+    my $ignore_dst_alpha = 0;
 
     # Nice and easy...
     if ( $src eq $dst && !$modulate && !$blend ) {
@@ -205,13 +224,17 @@
         return;
     }
 
+    if (not $dst =~ /A/) {
+        $ignore_dst_alpha = !$blend;
+    }
+
     if ( $blend ) {
-        get_rgba("src", $src);
-        get_rgba("dst", $dst);
+        get_rgba("src", $src, $ignore_dst_alpha);
+        get_rgba("dst", $dst, $ignore_dst_alpha);
         $s = "src";
         $d = "dst";
     } else {
-        get_rgba("", $src);
+        get_rgba("", $src, $ignore_dst_alpha);
     }
 
     if ( $modulate ) {
@@ -221,10 +244,14 @@
                 ${s}G = (${s}G * modulateG) / 255;
                 ${s}B = (${s}B * modulateB) / 255;
             }
+__EOF__
+        if (not $ignore_dst_alpha) {
+            print FILE <<__EOF__;
             if (flags & SDL_COPY_MODULATE_ALPHA) {
                 ${s}A = (${s}A * modulateA) / 255;
             }
 __EOF__
+        }
     }
     if ( $blend ) {
         print FILE <<__EOF__;
@@ -306,6 +333,23 @@
     int srcy, srcx;
     int posy, posx;
     int incy, incx;
+__EOF__
+
+    # !!! FIXME: the script should just exclude in these cases.
+    if ( (!$blend) && ($modulate || $src ne $dst) ) {
+        print FILE <<__EOF__;
+    (void) A;  /* not all formats use alpha. */
+__EOF__
+    }
+
+    # !!! FIXME: the script should just exclude in these cases.
+    if ( $modulate ) {
+        print FILE <<__EOF__;
+    (void) modulateA;  /* not all formats use alpha. */
+__EOF__
+    }
+
+    print FILE <<__EOF__;
 
     srcy = 0;
     posy = 0;
@@ -343,6 +387,20 @@
     }
 __EOF__
     } else {
+        # !!! FIXME: the script should just exclude in these cases.
+        if ( (!$blend) && ($modulate || $src ne $dst) ) {
+            print FILE <<__EOF__;
+    (void) A;  /* not all formats use alpha. */
+__EOF__
+        }
+
+        # !!! FIXME: the script should just exclude in these cases.
+        if ( $modulate ) {
+            print FILE <<__EOF__;
+    (void) modulateA;  /* not all formats use alpha. */
+__EOF__
+        }
+
         print FILE <<__EOF__;
 
     while (info->dst_h--) {