From 495e46197a52b4d7c3630b7b73013e70afe69e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 23 Jun 2006 17:13:10 +0200 Subject: [PATCH] ddraw/wined3d: IDirectDrawSurface7::SetSurfaceDesc corrections. --- dlls/ddraw/surface.c | 71 +++++++++++++++++++------------- dlls/wined3d/surface.c | 6 --- dlls/wined3d/surface_gdi.c | 1 - include/wine/wined3d_interface.h | 2 - 4 files changed, 42 insertions(+), 38 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 9da19f4b385..975f8cd9e9c 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1860,48 +1860,61 @@ IDirectDrawSurfaceImpl_SetSurfaceDesc(IDirectDrawSurface7 *iface, DWORD Flags) { ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface7, iface); - BYTE *newSurface = NULL; - DWORD newSize = 0; WINED3DFORMAT newFormat = WINED3DFMT_UNKNOWN; HRESULT hr; - FIXME("(%p)->(%p,%lx)\n", This, DDSD, Flags); - assert(0); + TRACE("(%p)->(%p,%lx)\n", This, DDSD, Flags); if(!DDSD) return DDERR_INVALIDPARAMS; + if (DDSD->dwFlags & DDSD_LPSURFACE && DDSD->lpSurface) + { + ERR("Setting the surface memory isn't supported yet\n"); + return DDERR_INVALIDPARAMS; + + } if (DDSD->dwFlags & DDSD_PIXELFORMAT) { newFormat = PixelFormat_DD2WineD3D(&DDSD->u4.ddpfPixelFormat); + + if(newFormat == WINED3DFMT_UNKNOWN) + { + ERR("Requested to set an unknown pixelformat\n"); + return DDERR_INVALIDPARAMS; + } + if(newFormat != PixelFormat_DD2WineD3D(&This->surface_desc.u4.ddpfPixelFormat) ) + { + hr = IWineD3DSurface_SetFormat(This->WineD3DSurface, + newFormat); + if(hr != DD_OK) return hr; + } } - if (DDSD->dwFlags & DDSD_LPSURFACE) + if (DDSD->dwFlags & DDSD_CKDESTOVERLAY) { - newSurface = DDSD->lpSurface; - newSize = DDSD->u1.dwLinearSize; - /* to avoid unpredictable things */ - assert(newSize != 0); + IWineD3DSurface_SetColorKey(This->WineD3DSurface, + DDCKEY_DESTOVERLAY, + &DDSD->u3.ddckCKDestOverlay); + } + if (DDSD->dwFlags & DDSD_CKDESTBLT) + { + IWineD3DSurface_SetColorKey(This->WineD3DSurface, + DDCKEY_DESTBLT, + &DDSD->ddckCKDestBlt); + } + if (DDSD->dwFlags & DDSD_CKSRCOVERLAY) + { + IWineD3DSurface_SetColorKey(This->WineD3DSurface, + DDCKEY_SRCOVERLAY, + &DDSD->ddckCKSrcOverlay); + } + if (DDSD->dwFlags & DDSD_CKSRCBLT) + { + IWineD3DSurface_SetColorKey(This->WineD3DSurface, + DDCKEY_SRCBLT, + &DDSD->ddckCKSrcBlt); } - /* Better: Use SetFormat */ - hr = IWineD3DSurface_SetPixelFormat(This->WineD3DSurface, - newFormat, - newSurface, - newSize); - if(hr != DD_OK) return hr; - - /* Store the new data. Not really necessary, as WineD3D stores it too, - * but for completeness - */ - if(newFormat != WINED3DFMT_UNKNOWN) - { - This->surface_desc.dwFlags |= DDSD_PIXELFORMAT; - This->surface_desc.u4.ddpfPixelFormat = DDSD->u4.ddpfPixelFormat; - } - if(newSurface != NULL) - { - This->surface_desc.lpSurface = newSurface; - This->surface_desc.u1.dwLinearSize = newSize; - } + This->surface_desc = *DDSD; return DD_OK; } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index dc9caa4101e..25a3e7a2257 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2536,11 +2536,6 @@ HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, D return IWineGDISurfaceImpl_BltFast(iface, dstx, dsty, Source, rsrc, trans); } -HRESULT WINAPI IWineD3DSurfaceImpl_SetPixelFormat(IWineD3DSurface *iface, WINED3DFORMAT Format, BYTE *Surface, DWORD Size) { - FIXME("This is unimplemented for now(d3d7 merge)\n"); - return WINED3DERR_INVALIDCALL; -} - HRESULT WINAPI IWineD3DSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD3DPalette **Pal) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; TRACE("(%p)->(%p)\n", This, Pal); @@ -2790,7 +2785,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl = IWineD3DSurfaceImpl_IsLost, IWineD3DSurfaceImpl_Restore, IWineD3DSurfaceImpl_BltFast, - IWineD3DSurfaceImpl_SetPixelFormat, IWineD3DSurfaceImpl_GetPalette, IWineD3DSurfaceImpl_SetPalette, IWineD3DSurfaceImpl_RealizePalette, diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c index b26f3c9c64b..3fe44af8887 100644 --- a/dlls/wined3d/surface_gdi.c +++ b/dlls/wined3d/surface_gdi.c @@ -1538,7 +1538,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl = IWineD3DSurfaceImpl_IsLost, IWineD3DSurfaceImpl_Restore, IWineGDISurfaceImpl_BltFast, - IWineD3DSurfaceImpl_SetPixelFormat, IWineD3DSurfaceImpl_GetPalette, IWineD3DSurfaceImpl_SetPalette, IWineD3DSurfaceImpl_RealizePalette, diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h index c4fea2532a2..5af0f95a73a 100644 --- a/include/wine/wined3d_interface.h +++ b/include/wine/wined3d_interface.h @@ -1133,7 +1133,6 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource) STDMETHOD(IsLost)(THIS) PURE; STDMETHOD(Restore)(THIS) PURE; STDMETHOD(BltFast)(THIS_ DWORD dstx, DWORD dsty, IWineD3DSurface *src, RECT *rsrc, DWORD trans) PURE; - STDMETHOD(SetPixelFormat)(THIS_ WINED3DFORMAT Format, BYTE *Surface, DWORD Size) PURE; STDMETHOD(GetPalette)(THIS_ struct IWineD3DPalette **Palette) PURE; STDMETHOD(SetPalette)(THIS_ struct IWineD3DPalette *Palette) PURE; STDMETHOD(RealizePalette)(THIS) PURE; @@ -1185,7 +1184,6 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource) #define IWineD3DSurface_IsLost(p) (p)->lpVtbl->IsLost(p) #define IWineD3DSurface_Restore(p) (p)->lpVtbl->Restore(p) #define IWineD3DSurface_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) -#define IWineD3DSurface_SetPixelFormat(p,a,b,c) (p)->lpVtbl->SetPixelFormat(p,a,b,c) #define IWineD3DSurface_GetPalette(p, a) (p)->lpVtbl->GetPalette(p, a) #define IWineD3DSurface_SetPalette(p, a) (p)->lpVtbl->SetPalette(p, a) #define IWineD3DSurface_RealizePalette(p) (p)->lpVtbl->RealizePalette(p)