Commits

Anonymous committed c49a85b

Trimmed down blit and fill functions to allow easier modification of the core algorithm.

Comments (0)

Files changed (6)

src/openal/capturedevice.c

 static PyMethodDef _capturedevice_methods[] = {
     { "start", (PyCFunction) _capturedevice_start, METH_NOARGS, NULL },
     { "stop", (PyCFunction) _capturedevice_stop, METH_NOARGS, NULL },
-    { "get_samples", (PyCFunction) _capturedevice_getsamples, METH_VARARGS, NULL },
+    { "get_samples", (PyCFunction) _capturedevice_getsamples, METH_VARARGS,
+      NULL },
     { NULL, NULL, 0, NULL }
 };
 
     if (SetALCErrorException (alcGetError (PyCaptureDevice_AsDevice(self)), 0))
         return NULL;
     if (count == 0)
-    {
         Py_RETURN_NONE;
-    }
     
     alcCaptureSamples (PyCaptureDevice_AsDevice (self), &buf, count);
     if (SetALCErrorException (alcGetError (PyCaptureDevice_AsDevice(self)), 0))
         return NULL;
+
     Py_RETURN_NONE;
 }
 

src/sdl/surface_blit.c

         }
         case BLEND_RGB_ADD:
         {
-            blit_blend_add (&info);
+            blit_blend_rgb_add (&info);
             break;
         }
         case BLEND_RGB_SUB:
         {
-            blit_blend_sub (&info);
+            blit_blend_rgb_sub (&info);
             break;
         }
         case BLEND_RGB_MULT:
         {
-            blit_blend_mul (&info);
+            blit_blend_rgb_mul (&info);
             break;
         }
         case BLEND_RGB_MIN:
         {
-            blit_blend_min (&info);
+            blit_blend_rgb_min (&info);
             break;
         }
         case BLEND_RGB_MAX:
         {
-            blit_blend_max (&info);
+            blit_blend_rgb_max (&info);
             break;
         }
         case BLEND_RGB_AND:
         {
-            blit_blend_and (&info);
+            blit_blend_rgb_and (&info);
             break;
         }
         case BLEND_RGB_OR:
         {
-            blit_blend_or (&info);
+            blit_blend_rgb_or (&info);
             break;
         }
         case BLEND_RGB_XOR:
         {
-            blit_blend_xor (&info);
+            blit_blend_rgb_xor (&info);
             break;
         }
         case BLEND_RGB_DIFF:
         {
-            blit_blend_diff (&info);
+            blit_blend_rgb_diff (&info);
             break;
         }
         case BLEND_RGB_SCREEN:
         {
-            blit_blend_screen (&info);
+            blit_blend_rgb_screen (&info);
             break;
         }
         case BLEND_RGB_AVG:
         {
-            blit_blend_avg (&info);
+            blit_blend_rgb_avg (&info);
             break;
         }
 

src/sdl/surface_blit.h

     SDL_PixelFormat *dst;
 } SDL_BlitInfo;
 
-void blit_blend_add (SDL_BlitInfo* info);
-void blit_blend_sub (SDL_BlitInfo* info);
-void blit_blend_mul (SDL_BlitInfo* info);
-void blit_blend_min (SDL_BlitInfo* info);
-void blit_blend_max (SDL_BlitInfo* info);
-void blit_blend_and (SDL_BlitInfo* info);
-void blit_blend_or (SDL_BlitInfo* info);
-void blit_blend_xor (SDL_BlitInfo* info);
-void blit_blend_diff (SDL_BlitInfo* info);
-void blit_blend_screen (SDL_BlitInfo* info);
-void blit_blend_avg (SDL_BlitInfo* info);
+void blit_blend_rgb_add (SDL_BlitInfo* info);
+void blit_blend_rgb_sub (SDL_BlitInfo* info);
+void blit_blend_rgb_mul (SDL_BlitInfo* info);
+void blit_blend_rgb_min (SDL_BlitInfo* info);
+void blit_blend_rgb_max (SDL_BlitInfo* info);
+void blit_blend_rgb_and (SDL_BlitInfo* info);
+void blit_blend_rgb_or (SDL_BlitInfo* info);
+void blit_blend_rgb_xor (SDL_BlitInfo* info);
+void blit_blend_rgb_diff (SDL_BlitInfo* info);
+void blit_blend_rgb_screen (SDL_BlitInfo* info);
+void blit_blend_rgb_avg (SDL_BlitInfo* info);
 
 void blit_blend_rgba_add (SDL_BlitInfo* info);
 void blit_blend_rgba_sub (SDL_BlitInfo* info);

src/sdl/surface_blit_rgb.c

 
 #include "surface_blit.h"
 
-void
-blit_blend_add (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-    Uint32          tmp;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_ADD (tmp, sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
+#define CREATE_BLITTER(_name,_blitop)                                   \
+    void blit_##_name(SDL_BlitInfo *info)                               \
+    {                                                                   \
+        int             n;                                              \
+        int             width = info->d_width;                          \
+        int             height = info->d_height;                        \
+        Uint8          *src = info->s_pixels;                           \
+        int             srcskip = info->s_skip;                         \
+        Uint8          *dst = info->d_pixels;                           \
+        int             dstskip = info->d_skip;                         \
+        SDL_PixelFormat *srcfmt = info->src;                            \
+        SDL_PixelFormat *dstfmt = info->dst;                            \
+        int             srcbpp = srcfmt->BytesPerPixel;                 \
+        int             dstbpp = dstfmt->BytesPerPixel;                 \
+        Uint8           dR, dG, dB, dA, sR, sG, sB, sA;                 \
+        Uint32          pixel;                                          \
+        Uint32          tmp;                                            \
+        Sint32          tmp2;                                           \
+                                                                        \
+        if (srcbpp == 4 && dstbpp == 4)                                 \
+        {                                                                   \
+            while (height--)                                                \
+            {                                                               \
+                LOOP_UNROLLED4(                                             \
+                {                                                           \
+                    GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA); \
+                    GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA); \
+                    _blitop;                                            \
+                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);      \
+                    src += srcbpp;                                          \
+                    dst += dstbpp;                                          \
+                }, n, width);                                               \
+                src += srcskip;                                             \
+                dst += dstskip;                                             \
+            }                                                               \
+            return;                                                         \
+        }                                                                   \
+                                                                        \
+        if (srcbpp == 1)                                                \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
+                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
+                        GET_PIXEL (pixel, dstbpp, dst);                 \
+                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+        }                                                               \
+        else /* srcbpp > 1 */                                           \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PIXEL(pixel, srcbpp, src);                  \
+                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
+                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+                                                                        \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PIXEL(pixel, srcbpp, src);                  \
+                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
+                        GET_PIXEL (pixel, dstbpp, dst);                 \
+                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+        }                                                               \
     }
 
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_ADD (tmp, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_ADD (tmp, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_ADD (tmp, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_ADD (tmp, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    /*
-                    printf ("VAL: %d %d %d || %d %d %d || 0x%.8x || 0x%.8x \n",
-                        sR, sG, sB, dR, dG, dB, *((Uint16*)dst),
-                        ((Uint16)SDL_MapRGB(dstfmt, dR, dG, dB)));
-                    */
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_sub (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-    Sint32          tmp2;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_SUB (tmp2, sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SUB (tmp2, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SUB (tmp2, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SUB (tmp2, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SUB (tmp2, sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_mul (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_MULT (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MULT (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MULT (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MULT (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MULT (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_min (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_MIN (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MIN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MIN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MIN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MIN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_max (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_MAX (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MAX (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MAX (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MAX (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_MAX (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_xor (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_XOR (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_XOR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_XOR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_XOR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_XOR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_and (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_AND (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AND (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AND (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AND (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AND (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_or (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_OR (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_OR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_OR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_OR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_OR (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_diff (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_DIFF (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_DIFF (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_DIFF (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_DIFF (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_DIFF (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_screen (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_SCREEN (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SCREEN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SCREEN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SCREEN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_SCREEN (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_avg (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGB_AVG (sR, sG, sB, dR, dG, dB);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AVG (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AVG (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AVG (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGB_AVG (sR, sG, sB, dR, dG, dB);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
+CREATE_BLITTER(blend_rgb_add, D_BLEND_RGB_ADD(tmp,sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_sub, D_BLEND_RGB_SUB(tmp2,sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_mul, D_BLEND_RGB_MULT(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_min, D_BLEND_RGB_MIN(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_max, D_BLEND_RGB_MAX(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_xor, D_BLEND_RGB_XOR(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_and, D_BLEND_RGB_AND(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_or, D_BLEND_RGB_OR(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_diff, D_BLEND_RGB_DIFF(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_screen, D_BLEND_RGB_SCREEN(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_avg, D_BLEND_RGB_AVG(sR,sG,sB,dR,dG,dB))

src/sdl/surface_blit_rgba.c

 
 #include "surface_blit.h"
 
-void
-blit_blend_rgba_add (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-    Uint32          tmp;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGBA_ADD (tmp, sR, sG, sB, sA, dR, dG, dB, dA);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
+#define CREATE_BLITTER(_name,_blitop)                                   \
+    void blit_##_name(SDL_BlitInfo *info)                               \
+    {                                                                   \
+        int             n;                                              \
+        int             width = info->d_width;                          \
+        int             height = info->d_height;                        \
+        Uint8          *src = info->s_pixels;                           \
+        int             srcskip = info->s_skip;                         \
+        Uint8          *dst = info->d_pixels;                           \
+        int             dstskip = info->d_skip;                         \
+        SDL_PixelFormat *srcfmt = info->src;                            \
+        SDL_PixelFormat *dstfmt = info->dst;                            \
+        int             srcbpp = srcfmt->BytesPerPixel;                 \
+        int             dstbpp = dstfmt->BytesPerPixel;                 \
+        Uint8           dR, dG, dB, dA, sR, sG, sB, sA;                 \
+        Uint32          pixel;                                          \
+        Uint32          tmp;                                            \
+        Sint32          tmp2;                                           \
+                                                                        \
+        if (srcbpp == 4 && dstbpp == 4)                                     \
+        {                                                                   \
+            while (height--)                                                \
+            {                                                               \
+                LOOP_UNROLLED4(                                             \
+                {                                                           \
+                    GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA); \
+                    GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA); \
+                    _blitop;                                            \
+                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);      \
+                    src += srcbpp;                                          \
+                    dst += dstbpp;                                          \
+                }, n, width);                                               \
+                src += srcskip;                                             \
+                dst += dstskip;                                             \
+            }                                                               \
+            return;                                                         \
+        }                                                                   \
+                                                                        \
+        if (srcbpp == 1)                                                \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
+                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
+                        GET_PIXEL (pixel, dstbpp, dst);                 \
+                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+        }                                                               \
+        else /* srcbpp > 1 */                                           \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PIXEL(pixel, srcbpp, src);                  \
+                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
+                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+                                                                        \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PIXEL(pixel, srcbpp, src);                  \
+                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
+                        GET_PIXEL (pixel, dstbpp, dst);                 \
+                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+        }                                                               \
     }
 
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_ADD (tmp, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_ADD (tmp, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_ADD (tmp, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_ADD (tmp, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_rgba_sub (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-    Sint32          tmp2;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGBA_SUB (tmp2, sR, sG, sB, sA, dR, dG, dB, dA);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_SUB (tmp2, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_SUB (tmp2, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_SUB (tmp2, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_SUB (tmp2, sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_rgba_mul (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGBA_MULT (sR, sG, sB, sA, dR, dG, dB, dA);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_MULT (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_MULT (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_MULT (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_MULT (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-void
-blit_blend_rgba_min (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    Uint8           dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-    if (srcbpp == 4 && dstbpp == 4)
-    {
-        while (height--)
-        {
-            LOOP_UNROLLED4(
-            {
-                GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA);
-                GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA);
-                D_BLEND_RGBA_MIN (sR, sG, sB, sA, dR, dG, dB, dA);
-                CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                src += srcbpp;
-                dst += dstbpp;
-            }, n, width);
-            src += srcskip;
-            dst += dstskip;
-        }
-        return;
-    }
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    D_BLEND_RGBA_MIN (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }