Stefan Dösinger : ddraw/wined3d: IDirectDrawSurface7:: SetSurfaceDesc corrections.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 26 07:11:29 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 495e46197a52b4d7c3630b7b73013e70afe69e54
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=495e46197a52b4d7c3630b7b73013e70afe69e54
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Fri Jun 23 17:13:10 2006 +0200
ddraw/wined3d: IDirectDrawSurface7::SetSurfaceDesc corrections.
---
dlls/ddraw/surface.c | 65 +++++++++++++++++++++++---------------
dlls/wined3d/surface.c | 6 ----
dlls/wined3d/surface_gdi.c | 1 -
include/wine/wined3d_interface.h | 2 -
4 files changed, 39 insertions(+), 35 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 9da19f4..975f8cd 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -1860,49 +1860,62 @@ IDirectDrawSurfaceImpl_SetSurfaceDesc(ID
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);
}
-
- /* 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)
+ if (DDSD->dwFlags & DDSD_CKDESTBLT)
+ {
+ IWineD3DSurface_SetColorKey(This->WineD3DSurface,
+ DDCKEY_DESTBLT,
+ &DDSD->ddckCKDestBlt);
+ }
+ if (DDSD->dwFlags & DDSD_CKSRCOVERLAY)
{
- This->surface_desc.dwFlags |= DDSD_PIXELFORMAT;
- This->surface_desc.u4.ddpfPixelFormat = DDSD->u4.ddpfPixelFormat;
+ IWineD3DSurface_SetColorKey(This->WineD3DSurface,
+ DDCKEY_SRCOVERLAY,
+ &DDSD->ddckCKSrcOverlay);
}
- if(newSurface != NULL)
+ if (DDSD->dwFlags & DDSD_CKSRCBLT)
{
- This->surface_desc.lpSurface = newSurface;
- This->surface_desc.u1.dwLinearSize = newSize;
+ IWineD3DSurface_SetColorKey(This->WineD3DSurface,
+ DDCKEY_SRCBLT,
+ &DDSD->ddckCKSrcBlt);
}
+ This->surface_desc = *DDSD;
+
return DD_OK;
}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index dc9caa4..25a3e7a 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2536,11 +2536,6 @@ HRESULT WINAPI IWineD3DSurfaceImpl_BltFa
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 IWineD3DSurfac
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 b26f3c9..3fe44af 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -1538,7 +1538,6 @@ const IWineD3DSurfaceVtbl IWineGDISurfac
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 c4fea25..5af0f95 100644
--- a/include/wine/wined3d_interface.h
+++ b/include/wine/wined3d_interface.h
@@ -1133,7 +1133,6 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWine
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 @@ #define IWineD3DSurface_GetFlipStatus(p,
#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)
More information about the wine-cvs
mailing list