DDraw: Fix IDirectDrawSurfaceImpl_SetColorKey to also change
surface_desc.
Günther Brammer
GBrammer at gmx.de
Sat Dec 9 16:13:14 CST 2006
IDirectDrawSurfaceImpl_GetColorKey uses surface_desc, so SetColorKey
should modify that. This fixes Bug 5730: Baldur's Gate uses the result
of GetColorKey as the color to use for the transparent background of
it's sprites.
---
dlls/ddraw/surface.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 4e54949..4d1e041 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -2056,6 +2056,58 @@ IDirectDrawSurfaceImpl_SetColorKey(IDirectDrawSurface7 *iface,
HRESULT hr;
TRACE("(%p)->(%x,%p)\n", This, Flags, CKey);
+ if (CKey)
+ {
+ switch (Flags & ~DDCKEY_COLORSPACE)
+ {
+ case DDCKEY_DESTBLT:
+ This->surface_desc.ddckCKDestBlt = *CKey;
+ This->surface_desc.dwFlags |= DDSD_CKDESTBLT;
+ break;
+
+ case DDCKEY_DESTOVERLAY:
+ This->surface_desc.u3.ddckCKDestOverlay = *CKey;
+ This->surface_desc.dwFlags |= DDSD_CKDESTOVERLAY;
+ break;
+
+ case DDCKEY_SRCOVERLAY:
+ This->surface_desc.ddckCKSrcOverlay = *CKey;
+ This->surface_desc.dwFlags |= DDSD_CKSRCOVERLAY;
+ break;
+
+ case DDCKEY_SRCBLT:
+ This->surface_desc.ddckCKSrcBlt = *CKey;
+ This->surface_desc.dwFlags |= DDSD_CKSRCBLT;
+ break;
+
+ default:
+ return DDERR_INVALIDPARAMS;
+ }
+ }
+ else
+ {
+ switch (Flags & ~DDCKEY_COLORSPACE)
+ {
+ case DDCKEY_DESTBLT:
+ This->surface_desc.dwFlags &= ~DDSD_CKDESTBLT;
+ break;
+
+ case DDCKEY_DESTOVERLAY:
+ This->surface_desc.dwFlags &= ~DDSD_CKDESTOVERLAY;
+ break;
+
+ case DDCKEY_SRCOVERLAY:
+ This->surface_desc.dwFlags &= ~DDSD_CKSRCOVERLAY;
+ break;
+
+ case DDCKEY_SRCBLT:
+ This->surface_desc.dwFlags &= ~DDSD_CKSRCBLT;
+ break;
+
+ default:
+ return DDERR_INVALIDPARAMS;
+ }
+ }
for(surf = This->first_complex; surf; surf = surf->next_complex)
{
hr = IWineD3DSurface_SetColorKey(surf->WineD3DSurface,
--
1.4.4.1
More information about the wine-patches
mailing list