ddraw/wined3d: IDirectDrawSurface7::SetSurfaceDesc corrections.

oldstable
Stefan Dösinger 2006-06-23 17:13:10 +02:00 committed by Alexandre Julliard
parent 8059576c8b
commit 495e46197a
4 changed files with 42 additions and 38 deletions

View File

@ -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;
}

View File

@ -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,

View File

@ -1538,7 +1538,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
IWineD3DSurfaceImpl_IsLost,
IWineD3DSurfaceImpl_Restore,
IWineGDISurfaceImpl_BltFast,
IWineD3DSurfaceImpl_SetPixelFormat,
IWineD3DSurfaceImpl_GetPalette,
IWineD3DSurfaceImpl_SetPalette,
IWineD3DSurfaceImpl_RealizePalette,

View File

@ -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)