Index: trunk/src/ddraw/OS2SURFACE.CPP
===================================================================
--- trunk/src/ddraw/OS2SURFACE.CPP	(revision 3160)
+++ trunk/src/ddraw/OS2SURFACE.CPP	(revision 3161)
@@ -1,3 +1,3 @@
-/* $Id: OS2SURFACE.CPP,v 1.24 2000-03-03 19:21:24 hugh Exp $ */
+/* $Id: OS2SURFACE.CPP,v 1.25 2000-03-18 21:17:58 mike Exp $ */
 
 /*
@@ -1665,5 +1665,5 @@
 //******************************************************************************
 // Internal callbacks uses by destructor
-int  DestroyRects(LPVOID lpItem, DWORD dwRes)
+INT CALLBACK DestroyRects(LPVOID lpItem, DWORD dwRes)
 {
   DDRectangle *pItem = (DDRectangle*) lpItem;
@@ -1672,5 +1672,5 @@
 }
 
-int ReleaseSurfaces(LPVOID lpItem, DWORD dwRes)
+INT CALLBACK ReleaseSurfaces(LPVOID lpItem, DWORD dwRes)
 {
   OS2IDirectDrawSurface *pSurf;
@@ -1722,5 +1722,5 @@
   {
     DPA_DestroyCallback( DPA_LockedRects,
-                         (DPAENUMPROC)DestroyRects,
+                         DestroyRects,
                          0);
   }
@@ -1750,5 +1750,5 @@
   {
     DPA_DestroyCallback( DPA_SurfaceMipMaps,
-                         (DPAENUMPROC)ReleaseSurfaces,
+                         ReleaseSurfaces,
                          0);
   }
@@ -1757,5 +1757,5 @@
   {
     DPA_DestroyCallback( DPA_SurfaceAttached,
-                         (DPAENUMPROC)ReleaseSurfaces,
+                         ReleaseSurfaces,
                          0);
   }
@@ -2296,7 +2296,5 @@
     {
       delete pIRectDest;
-      #ifdef DEBUG
-        dprintf(("DDRAW: Blt: Dest Surface partly locked\n"));
-      #endif
+      dprintf(("DDRAW: Blt: Dest Surface partly locked\n"));
       return(DDERR_SURFACEBUSY);
     }
@@ -2380,7 +2378,6 @@
   if(NULL==src)
   {
-    #ifdef DEBUG
-      dprintf(("DDRAW: Unsupported sourceless FX operation. Flags = 0x%04X\n",dwFlags));
-    #endif
+    dprintf(("DDRAW: Unsupported sourceless FX operation. Flags = 0x%04X\n",dwFlags));
+
     return DD_OK;
   }
@@ -2479,7 +2476,6 @@
     {
       delete pIRectSrc;
-      #ifdef DEBUG
-        dprintf(("DDRAW: Blt: Src Surface partly locked\n"));
-      #endif
+      dprintf(("DDRAW: Blt: Src Surface partly locked\n"));
+
       return(DDERR_SURFACEBUSY);
     }
@@ -2489,7 +2485,6 @@
       ( (NULL==lpSrcRect) && (NULL!=lpDestRect) ) )
   {
-    #ifdef DEBUG
-      dprintf(("DDRAW: Blitting with scaleing\n Not supported.\n"));
-    #endif
+    dprintf(("DDRAW: Blitting with scaleing\n Not supported.\n"));
+
     return DDERR_NOSTRETCHHW;
   }
@@ -2994,4 +2989,86 @@
           else
           {
+            // This will be be slow maybe move to ASM ?
+            // using MMX should be much faster
+            switch(dest->dwBytesPPDive)
+            {
+              case 1:
+                while(BlitHeight--)
+                {
+                  x = 0;
+                  while(x<BlitWidth)
+                  {
+                    if(pSrcPos[x] != (char) dwSrcColor)
+                    {
+                      pBltPos[x] = pSrcPos[x];
+                    }
+                    x++;
+                  }
+                  pBltPos += dwPitch;
+                  pSrcPos += src->dwPitchDB;
+                }
+                break;
+              case 2:
+                while(BlitHeight--)
+                {
+                  x = 0;
+                  while(x<BlitWidth)
+                  {
+                    if(((USHORT*)pSrcPos)[x] != (USHORT) dwSrcColor)
+                    {
+                      ((USHORT*)pBltPos)[x] = ((USHORT*)pSrcPos)[x];
+                    }
+                    x++;
+                  }
+                  pBltPos += dwPitch;
+                  pSrcPos += src->dwPitchDB;
+                }
+                break;
+              case 3:
+              {
+                char *pSC, *pDC;
+                pSC = (char*)&dwSrcColor;
+                pDC = (char*)&dwDestColor;
+                BlitWidth *=3;
+
+                while(BlitHeight--)
+                {
+                  x = 0;
+
+                  while(x<BlitWidth)
+                  {
+                    if( (pSrcPos[x]   != pSC[1]) &&
+                        (pSrcPos[x+1] != pSC[2]) &&
+                        (pSrcPos[x+2] != pSC[3])
+                      )
+                    {
+                       pBltPos[x] = pSrcPos[x];
+                       pBltPos[x+1] = pSrcPos[x+2];
+                       pBltPos[x+1] = pSrcPos[x+2];
+                    }
+                    x +=3;
+                  }
+                  pBltPos += dwPitch;
+                  pSrcPos += src->dwPitchDB;
+                }
+                break;
+              }
+              case 4:
+                while(BlitHeight--)
+                {
+                  x = 0;
+                  while(x<BlitWidth)
+                  {
+                    if(((DWORD*)pSrcPos)[x] != dwSrcColor)
+                    {
+                      ((DWORD*)pBltPos)[x] = ((DWORD*)pSrcPos)[x];
+                    }
+                    x++;
+                  }
+                  pBltPos += dwPitch;
+                  pSrcPos += src->dwPitchDB;
+                }
+                break;
+            }  // End switch
             // Only Source colorkey
           }
