Commit f3ae1b99 authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

ddraw: Separate IDirectDrawSurface vtable.

parent 27063ffe
...@@ -2071,7 +2071,7 @@ static HRESULT WINAPI ddraw3_GetGDISurface(IDirectDraw3 *iface, IDirectDrawSurfa ...@@ -2071,7 +2071,7 @@ static HRESULT WINAPI ddraw3_GetGDISurface(IDirectDraw3 *iface, IDirectDrawSurfa
return hr; return hr;
} }
surface_impl = impl_from_IDirectDrawSurface7(surface7); surface_impl = impl_from_IDirectDrawSurface7(surface7);
*surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; *surface = &surface_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
...@@ -2092,7 +2092,7 @@ static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurfa ...@@ -2092,7 +2092,7 @@ static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurfa
return hr; return hr;
} }
surface_impl = impl_from_IDirectDrawSurface7(surface7); surface_impl = impl_from_IDirectDrawSurface7(surface7);
*surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; *surface = &surface_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
...@@ -2113,7 +2113,7 @@ static HRESULT WINAPI ddraw1_GetGDISurface(IDirectDraw *iface, IDirectDrawSurfac ...@@ -2113,7 +2113,7 @@ static HRESULT WINAPI ddraw1_GetGDISurface(IDirectDraw *iface, IDirectDrawSurfac
return hr; return hr;
} }
surface_impl = impl_from_IDirectDrawSurface7(surface7); surface_impl = impl_from_IDirectDrawSurface7(surface7);
*surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; *surface = &surface_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
...@@ -2486,7 +2486,7 @@ static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, ...@@ -2486,7 +2486,7 @@ static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc,
} }
surface_impl = impl_from_IDirectDrawSurface7(surface7); surface_impl = impl_from_IDirectDrawSurface7(surface7);
/* Tests say this is true */ /* Tests say this is true */
*surface = (IDirectDrawSurface4 *)&surface_impl->IDirectDrawSurface3_iface; *surface = (IDirectDrawSurface4 *)&surface_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
...@@ -2511,7 +2511,7 @@ static HRESULT WINAPI ddraw3_GetSurfaceFromDC(IDirectDraw3 *iface, HDC dc, ...@@ -2511,7 +2511,7 @@ static HRESULT WINAPI ddraw3_GetSurfaceFromDC(IDirectDraw3 *iface, HDC dc,
} }
surface_impl = impl_from_IDirectDrawSurface7(surface7); surface_impl = impl_from_IDirectDrawSurface7(surface7);
*surface = (IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface; *surface = &surface_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
...@@ -3605,7 +3605,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, DDSURFACEDESC *s ...@@ -3605,7 +3605,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, DDSURFACEDESC *s
return hr; return hr;
} }
*surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_iface; *surface = &impl->IDirectDrawSurface_iface;
ddraw_set_surface_version(impl, 3); ddraw_set_surface_version(impl, 3);
IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw7_Release(&This->IDirectDraw7_iface);
IDirectDraw3_AddRef(iface); IDirectDraw3_AddRef(iface);
...@@ -3649,7 +3649,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, ...@@ -3649,7 +3649,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
return hr; return hr;
} }
*surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_iface; *surface = &impl->IDirectDrawSurface_iface;
ddraw_set_surface_version(impl, 2); ddraw_set_surface_version(impl, 2);
IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw7_Release(&This->IDirectDraw7_iface);
impl->ifaceToRelease = NULL; impl->ifaceToRelease = NULL;
...@@ -3683,7 +3683,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, ...@@ -3683,7 +3683,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
return hr; return hr;
} }
*surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_iface; *surface = &impl->IDirectDrawSurface_iface;
ddraw_set_surface_version(impl, 1); ddraw_set_surface_version(impl, 1);
IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw7_Release(&This->IDirectDraw7_iface);
impl->ifaceToRelease = NULL; impl->ifaceToRelease = NULL;
...@@ -3815,7 +3815,7 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, ...@@ -3815,7 +3815,7 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface,
IDirectDrawSurfaceImpl *surface_impl = impl_from_IDirectDrawSurface7(surface); IDirectDrawSurfaceImpl *surface_impl = impl_from_IDirectDrawSurface7(surface);
struct surfacescallback_context *cbcontext = context; struct surfacescallback_context *cbcontext = context;
return cbcontext->func((IDirectDrawSurface *)&surface_impl->IDirectDrawSurface3_iface, return cbcontext->func(&surface_impl->IDirectDrawSurface_iface,
(DDSURFACEDESC *)surface_desc, cbcontext->context); (DDSURFACEDESC *)surface_desc, cbcontext->context);
} }
...@@ -4277,7 +4277,7 @@ static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSu ...@@ -4277,7 +4277,7 @@ static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSu
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
dst_impl = impl_from_IDirectDrawSurface7(dst7); dst_impl = impl_from_IDirectDrawSurface7(dst7);
*dst = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface; *dst = &dst_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
...@@ -4297,7 +4297,7 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface, ...@@ -4297,7 +4297,7 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface,
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
dst_impl = impl_from_IDirectDrawSurface7(dst7); dst_impl = impl_from_IDirectDrawSurface7(dst7);
*dst = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface; *dst = &dst_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
...@@ -4317,7 +4317,7 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur ...@@ -4317,7 +4317,7 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
dst_impl = impl_from_IDirectDrawSurface7(dst7); dst_impl = impl_from_IDirectDrawSurface7(dst7);
*dst = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface; *dst = &dst_impl->IDirectDrawSurface_iface;
return hr; return hr;
} }
......
...@@ -156,6 +156,7 @@ struct IDirectDrawSurfaceImpl ...@@ -156,6 +156,7 @@ struct IDirectDrawSurfaceImpl
IDirectDrawSurface4 IDirectDrawSurface4_iface; IDirectDrawSurface4 IDirectDrawSurface4_iface;
IDirectDrawSurface3 IDirectDrawSurface3_iface; IDirectDrawSurface3 IDirectDrawSurface3_iface;
IDirectDrawSurface2 IDirectDrawSurface2_iface; IDirectDrawSurface2 IDirectDrawSurface2_iface;
IDirectDrawSurface IDirectDrawSurface_iface;
IDirectDrawGammaControl IDirectDrawGammaControl_iface; IDirectDrawGammaControl IDirectDrawGammaControl_iface;
const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl; const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl;
const IDirect3DTextureVtbl *IDirect3DTexture_vtbl; const IDirect3DTextureVtbl *IDirect3DTexture_vtbl;
...@@ -222,6 +223,11 @@ static inline IDirectDrawSurfaceImpl *surface_from_texture2(IDirect3DTexture2 *i ...@@ -222,6 +223,11 @@ static inline IDirectDrawSurfaceImpl *surface_from_texture2(IDirect3DTexture2 *i
return (IDirectDrawSurfaceImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirect3DTexture2_vtbl)); return (IDirectDrawSurfaceImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirect3DTexture2_vtbl));
} }
static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
{
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface_iface);
}
static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface) static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface)
{ {
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface2_iface); return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface2_iface);
......
...@@ -1981,7 +1981,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_GetRenderTarget(IDirect3DDevice2 *if ...@@ -1981,7 +1981,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_GetRenderTarget(IDirect3DDevice2 *if
hr = IDirect3DDevice7_GetRenderTarget((IDirect3DDevice7 *)This, &RenderTarget7); hr = IDirect3DDevice7_GetRenderTarget((IDirect3DDevice7 *)This, &RenderTarget7);
if(hr != D3D_OK) return hr; if(hr != D3D_OK) return hr;
RenderTargetImpl = impl_from_IDirectDrawSurface7(RenderTarget7); RenderTargetImpl = impl_from_IDirectDrawSurface7(RenderTarget7);
*RenderTarget = (IDirectDrawSurface *)&RenderTargetImpl->IDirectDrawSurface3_iface; *RenderTarget = &RenderTargetImpl->IDirectDrawSurface_iface;
return D3D_OK; return D3D_OK;
} }
......
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