Use this version instead as the previous one didn't compile due to an extra '(' 
:(

Roderick

> Hi,
> 
> This patch adds color keying support to *_BltOverride. It required changes
> to *_BltFast to properly pass 'BLT' flags instead of 'BLTFAST' to
> *_BltOverride. Next it adds SRC/DEST color keying to *_BltOverride.
> 
> Further to get color keying working at all it fixed a small error in
> LoadTexture which I paste here because it is hard to spot in the patch. Right
> now a check in there looks like:
> (This->Flags & SFLAG_GLCKEY && !(This->CKeyFlags & DDSD_CKSRCBLT)) ||
> /* Reload: vice versa  OR */
> (!(This->Flags & SFLAG_GLCKEY) && !This->CKeyFlags & DDSD_CKSRCBLT) ||
> 
> The third '!' was removed as indicated by the comment this fixes color
> keying. Next to this some gcc warning was silenced by adding some more braces.
> 
> Regards,
> Roderick Colenbrander
> 


-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
Index: dlls/wined3d/surface.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/surface.c,v
retrieving revision 1.100
diff -u -r1.100 surface.c
--- dlls/wined3d/surface.c	26 Jul 2006 14:01:26 -0000	1.100
+++ dlls/wined3d/surface.c	26 Jul 2006 21:16:26 -0000
@@ -1635,13 +1635,13 @@
     if (This->Flags & SFLAG_DIRTY) {
         TRACE("Reloading because surface is dirty\n");
     } else if(/* Reload: gl texture has ck, now no ckey is set OR */
-              (This->Flags & SFLAG_GLCKEY && !(This->CKeyFlags & DDSD_CKSRCBLT)) ||
+              ((This->Flags & SFLAG_GLCKEY) && (!(This->CKeyFlags & DDSD_CKSRCBLT))) ||
               /* Reload: vice versa  OR */
-              (!(This->Flags & SFLAG_GLCKEY) && !This->CKeyFlags & DDSD_CKSRCBLT) ||
+              ((!(This->Flags & SFLAG_GLCKEY)) && (This->CKeyFlags & DDSD_CKSRCBLT)) ||
               /* Also reload: Color key is active AND the color key has changed */
-              (This->CKeyFlags & DDSD_CKSRCBLT) && (
-                This->glCKey.dwColorSpaceLowValue != This->SrcBltCKey.dwColorSpaceLowValue ||
-                This->glCKey.dwColorSpaceHighValue != This->SrcBltCKey.dwColorSpaceHighValue)) {
+              ((This->CKeyFlags & DDSD_CKSRCBLT) && (
+                (This->glCKey.dwColorSpaceLowValue != This->SrcBltCKey.dwColorSpaceLowValue) ||
+                (This->glCKey.dwColorSpaceHighValue != This->SrcBltCKey.dwColorSpaceHighValue)))) {
         TRACE("Reloading because of color keying\n");
     } else {
         TRACE("surface isn't dirty\n");
@@ -2304,6 +2304,7 @@
                 ( swapchain->backBuffer && (IWineD3DSurface *) Src != swapchain->backBuffer[0]) ) ) {
             float glTexCoord[4];
             DWORD oldCKey;
+            DDCOLORKEY oldBltCKey = {0,0};
             GLint oldLight, oldFog, oldDepth, oldBlend, oldCull, oldAlpha;
             GLint alphafunc;
             GLclampf alpharef;
@@ -2345,6 +2346,16 @@
                 Src->CKeyFlags &= ~DDSD_CKSRCBLT;
             }
 
+            /* Color keying */
+            if(Flags & DDBLT_KEYDEST) {
+                oldBltCKey = This->SrcBltCKey;
+                /* Temporary replace the source color key with the destination one. We do this because the color conversion code which
+                 * is in the end called from LoadTexture works with the source color. At the end of this function we restore the color key.
+                 */
+                This->SrcBltCKey = This->DestBltCKey;
+            } else if (Flags & DDBLT_KEYSRC)
+                oldBltCKey = This->SrcBltCKey;
+
             /* Now load the surface */
             IWineD3DSurface_PreLoad((IWineD3DSurface *) Src);
 
@@ -2506,11 +2517,15 @@
                 glDrawBuffer(oldDraw);
             }
 
-            /* Restore the color key */
+            /* Restore the color key flags */
             if(oldCKey != Src->CKeyFlags) {
                 Src->CKeyFlags = oldCKey;
             }
 
+            /* Restore the old color key */
+            if (Flags & (DDBLT_KEYSRC | DDBLT_KEYDEST))
+                This->SrcBltCKey = oldBltCKey;
+
             LEAVE_GL();
 
             /* TODO: If the surface is locked often, perform the Blt in software on the memory instead */
@@ -2759,6 +2774,7 @@
         ( srcImpl && (srcImpl->resource.usage & WINED3DUSAGE_RENDERTARGET) )) {
 
         RECT SrcRect, DstRect;
+        DWORD Flags=0;
 
         if(rsrc) {
             SrcRect.left = rsrc->left;
@@ -2777,7 +2793,17 @@
         DstRect.right = dstx + SrcRect.right - SrcRect.left;
         DstRect.bottom = dsty + SrcRect.bottom - SrcRect.top;
 
-        if(IWineD3DSurfaceImpl_BltOverride(This, &DstRect, Source, &SrcRect, 0, NULL) == WINED3D_OK) return WINED3D_OK;
+        /* Convert BltFast flags into Btl ones because it is called from SurfaceImpl_Blt aswell */
+        if(trans & DDBLTFAST_SRCCOLORKEY)
+            Flags |= DDBLT_KEYSRC;
+        if(trans & DDBLTFAST_DESTCOLORKEY)
+            Flags |= DDBLT_KEYDEST;
+        if(trans & DDBLTFAST_WAIT)
+            Flags |= DDBLT_WAIT;
+        if(trans & DDBLTFAST_DONOTWAIT)
+            Flags |= DDBLT_DONOTWAIT;
+
+        if(IWineD3DSurfaceImpl_BltOverride(This, &DstRect, Source, &SrcRect, Flags, NULL) == WINED3D_OK) return WINED3D_OK;
     }
 
 


Reply via email to