Commit 495e4619 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw/wined3d: IDirectDrawSurface7::SetSurfaceDesc corrections.

parent 8059576c
...@@ -1860,49 +1860,62 @@ IDirectDrawSurfaceImpl_SetSurfaceDesc(IDirectDrawSurface7 *iface, ...@@ -1860,49 +1860,62 @@ IDirectDrawSurfaceImpl_SetSurfaceDesc(IDirectDrawSurface7 *iface,
DWORD Flags) DWORD Flags)
{ {
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface7, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface7, iface);
BYTE *newSurface = NULL;
DWORD newSize = 0;
WINED3DFORMAT newFormat = WINED3DFMT_UNKNOWN; WINED3DFORMAT newFormat = WINED3DFMT_UNKNOWN;
HRESULT hr; HRESULT hr;
FIXME("(%p)->(%p,%lx)\n", This, DDSD, Flags); TRACE("(%p)->(%p,%lx)\n", This, DDSD, Flags);
assert(0);
if(!DDSD) if(!DDSD)
return DDERR_INVALIDPARAMS; 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) if (DDSD->dwFlags & DDSD_PIXELFORMAT)
{ {
newFormat = PixelFormat_DD2WineD3D(&DDSD->u4.ddpfPixelFormat); 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; IWineD3DSurface_SetColorKey(This->WineD3DSurface,
newSize = DDSD->u1.dwLinearSize; DDCKEY_DESTOVERLAY,
/* to avoid unpredictable things */ &DDSD->u3.ddckCKDestOverlay);
assert(newSize != 0);
} }
if (DDSD->dwFlags & DDSD_CKDESTBLT)
/* Better: Use SetFormat */ {
hr = IWineD3DSurface_SetPixelFormat(This->WineD3DSurface, IWineD3DSurface_SetColorKey(This->WineD3DSurface,
newFormat, DDCKEY_DESTBLT,
newSurface, &DDSD->ddckCKDestBlt);
newSize); }
if(hr != DD_OK) return hr; if (DDSD->dwFlags & DDSD_CKSRCOVERLAY)
/* 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; IWineD3DSurface_SetColorKey(This->WineD3DSurface,
This->surface_desc.u4.ddpfPixelFormat = DDSD->u4.ddpfPixelFormat; DDCKEY_SRCOVERLAY,
&DDSD->ddckCKSrcOverlay);
} }
if(newSurface != NULL) if (DDSD->dwFlags & DDSD_CKSRCBLT)
{ {
This->surface_desc.lpSurface = newSurface; IWineD3DSurface_SetColorKey(This->WineD3DSurface,
This->surface_desc.u1.dwLinearSize = newSize; DDCKEY_SRCBLT,
&DDSD->ddckCKSrcBlt);
} }
This->surface_desc = *DDSD;
return DD_OK; return DD_OK;
} }
......
...@@ -2536,11 +2536,6 @@ HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, D ...@@ -2536,11 +2536,6 @@ HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, D
return IWineGDISurfaceImpl_BltFast(iface, dstx, dsty, Source, rsrc, trans); 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) { HRESULT WINAPI IWineD3DSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD3DPalette **Pal) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
TRACE("(%p)->(%p)\n", This, Pal); TRACE("(%p)->(%p)\n", This, Pal);
...@@ -2790,7 +2785,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl = ...@@ -2790,7 +2785,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
IWineD3DSurfaceImpl_IsLost, IWineD3DSurfaceImpl_IsLost,
IWineD3DSurfaceImpl_Restore, IWineD3DSurfaceImpl_Restore,
IWineD3DSurfaceImpl_BltFast, IWineD3DSurfaceImpl_BltFast,
IWineD3DSurfaceImpl_SetPixelFormat,
IWineD3DSurfaceImpl_GetPalette, IWineD3DSurfaceImpl_GetPalette,
IWineD3DSurfaceImpl_SetPalette, IWineD3DSurfaceImpl_SetPalette,
IWineD3DSurfaceImpl_RealizePalette, IWineD3DSurfaceImpl_RealizePalette,
......
...@@ -1538,7 +1538,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl = ...@@ -1538,7 +1538,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
IWineD3DSurfaceImpl_IsLost, IWineD3DSurfaceImpl_IsLost,
IWineD3DSurfaceImpl_Restore, IWineD3DSurfaceImpl_Restore,
IWineGDISurfaceImpl_BltFast, IWineGDISurfaceImpl_BltFast,
IWineD3DSurfaceImpl_SetPixelFormat,
IWineD3DSurfaceImpl_GetPalette, IWineD3DSurfaceImpl_GetPalette,
IWineD3DSurfaceImpl_SetPalette, IWineD3DSurfaceImpl_SetPalette,
IWineD3DSurfaceImpl_RealizePalette, IWineD3DSurfaceImpl_RealizePalette,
......
...@@ -1133,7 +1133,6 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource) ...@@ -1133,7 +1133,6 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
STDMETHOD(IsLost)(THIS) PURE; STDMETHOD(IsLost)(THIS) PURE;
STDMETHOD(Restore)(THIS) PURE; STDMETHOD(Restore)(THIS) PURE;
STDMETHOD(BltFast)(THIS_ DWORD dstx, DWORD dsty, IWineD3DSurface *src, RECT *rsrc, DWORD trans) 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(GetPalette)(THIS_ struct IWineD3DPalette **Palette) PURE;
STDMETHOD(SetPalette)(THIS_ struct IWineD3DPalette *Palette) PURE; STDMETHOD(SetPalette)(THIS_ struct IWineD3DPalette *Palette) PURE;
STDMETHOD(RealizePalette)(THIS) PURE; STDMETHOD(RealizePalette)(THIS) PURE;
...@@ -1185,7 +1184,6 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource) ...@@ -1185,7 +1184,6 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
#define IWineD3DSurface_IsLost(p) (p)->lpVtbl->IsLost(p) #define IWineD3DSurface_IsLost(p) (p)->lpVtbl->IsLost(p)
#define IWineD3DSurface_Restore(p) (p)->lpVtbl->Restore(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_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_GetPalette(p, a) (p)->lpVtbl->GetPalette(p, a)
#define IWineD3DSurface_SetPalette(p, a) (p)->lpVtbl->SetPalette(p, a) #define IWineD3DSurface_SetPalette(p, a) (p)->lpVtbl->SetPalette(p, a)
#define IWineD3DSurface_RealizePalette(p) (p)->lpVtbl->RealizePalette(p) #define IWineD3DSurface_RealizePalette(p) (p)->lpVtbl->RealizePalette(p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment