ddraw: Change lpVtbl to IDirectDrawSurface7_iface.

This commit is contained in:
Ričardas Barkauskas 2011-06-05 19:55:04 +03:00 committed by Alexandre Julliard
parent 4074dd7615
commit 2f02bbb41f
4 changed files with 128 additions and 118 deletions

View File

@ -3407,7 +3407,7 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
if(hr != DD_OK) if(hr != DD_OK)
{ {
/* This destroys and possibly created surfaces too */ /* This destroys and possibly created surfaces too */
IDirectDrawSurface_Release((IDirectDrawSurface7 *)object); IDirectDrawSurface7_Release(&object->IDirectDrawSurface7_iface);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
@ -3521,7 +3521,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
return hr; return hr;
} }
*surface = (IDirectDrawSurface7 *)impl; *surface = &impl->IDirectDrawSurface7_iface;
return hr; return hr;
} }
@ -3874,8 +3874,8 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags,
if (all || (nomatch != ddraw_match_surface_desc(DDSD, &surf->surface_desc))) if (all || (nomatch != ddraw_match_surface_desc(DDSD, &surf->surface_desc)))
{ {
desc = surf->surface_desc; desc = surf->surface_desc;
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)surf); IDirectDrawSurface7_AddRef(&surf->IDirectDrawSurface7_iface);
if (Callback((IDirectDrawSurface7 *)surf, &desc, Context) != DDENUMRET_OK) if (Callback(&surf->IDirectDrawSurface7_iface, &desc, Context) != DDENUMRET_OK)
{ {
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -4250,7 +4250,7 @@ static HRESULT WINAPI ddraw4_DuplicateSurface(IDirectDraw4 *iface, IDirectDrawSu
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface,
(IDirectDrawSurface7 *)src_impl, &dst7); src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, &dst7);
if (FAILED(hr)) if (FAILED(hr))
{ {
*dst = NULL; *dst = NULL;
@ -4272,11 +4272,13 @@ static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSu
HRESULT hr; HRESULT hr;
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, (IDirectDrawSurface7 *)src_impl, &dst7); hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface,
src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, &dst7);
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 = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface;
return hr; return hr;
} }
@ -4290,11 +4292,13 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface,
HRESULT hr; HRESULT hr;
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, (IDirectDrawSurface7 *)src_impl, &dst7); hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface,
src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, &dst7);
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 = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface;
return hr; return hr;
} }
@ -4308,11 +4312,13 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur
HRESULT hr; HRESULT hr;
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, (IDirectDrawSurface7 *)src_impl, &dst7); hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface,
src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, &dst7);
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 = (IDirectDrawSurface *)&dst_impl->IDirectDrawSurface3_iface;
return hr; return hr;
} }
@ -4873,6 +4879,7 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid,
IDirectDrawSurface4 *surface, IDirect3DDevice3 **device, IUnknown *outer_unknown) IDirectDrawSurface4 *surface, IDirect3DDevice3 **device, IUnknown *outer_unknown)
{ {
IDirectDrawImpl *This = impl_from_IDirect3D3(iface); IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
IDirectDrawSurfaceImpl *surface_impl = (IDirectDrawSurfaceImpl *)surface;
HRESULT hr; HRESULT hr;
TRACE("iface %p, riid %s, surface %p, device %p, outer_unknown %p.\n", TRACE("iface %p, riid %s, surface %p, device %p, outer_unknown %p.\n",
@ -4880,7 +4887,8 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid,
if (outer_unknown) return CLASS_E_NOAGGREGATION; if (outer_unknown) return CLASS_E_NOAGGREGATION;
hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid, (IDirectDrawSurface7 *)surface, hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid,
surface_impl ? &surface_impl->IDirectDrawSurface7_iface : NULL,
(IDirect3DDevice7 **)device); (IDirect3DDevice7 **)device);
if (*device) *device = (IDirect3DDevice3 *)&((IDirect3DDeviceImpl *)*device)->IDirect3DDevice3_vtbl; if (*device) *device = (IDirect3DDevice3 *)&((IDirect3DDeviceImpl *)*device)->IDirect3DDevice3_vtbl;
@ -4898,7 +4906,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
iface, debugstr_guid(riid), surface, device); iface, debugstr_guid(riid), surface, device);
hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid, hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid,
surface_impl ? (IDirectDrawSurface7 *)surface_impl : NULL, surface_impl ? &surface_impl->IDirectDrawSurface7_iface : NULL,
(IDirect3DDevice7 **)device); (IDirect3DDevice7 **)device);
if (*device) *device = (IDirect3DDevice2 *)&((IDirect3DDeviceImpl *)*device)->IDirect3DDevice2_vtbl; if (*device) *device = (IDirect3DDevice2 *)&((IDirect3DDeviceImpl *)*device)->IDirect3DDevice2_vtbl;
@ -5796,7 +5804,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
if (!surf) if (!surf)
{ {
IDirectDrawSurface7 *attached; IDirectDrawSurface7 *attached;
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)ddraw->tex_root, &searchcaps, &attached); IDirectDrawSurface7_GetAttachedSurface(&ddraw->tex_root->IDirectDrawSurface7_iface, &searchcaps, &attached);
surf = unsafe_impl_from_IDirectDrawSurface7(attached); surf = unsafe_impl_from_IDirectDrawSurface7(attached);
IDirectDrawSurface7_Release(attached); IDirectDrawSurface7_Release(attached);
} }
@ -5806,7 +5814,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
while (i < level) while (i < level)
{ {
IDirectDrawSurface7 *attached; IDirectDrawSurface7 *attached;
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)surf, &searchcaps, &attached); IDirectDrawSurface7_GetAttachedSurface(&surf->IDirectDrawSurface7_iface, &searchcaps, &attached);
if(!attached) ERR("Surface not found\n"); if(!attached) ERR("Surface not found\n");
surf = impl_from_IDirectDrawSurface7(attached); surf = impl_from_IDirectDrawSurface7(attached);
IDirectDrawSurface7_Release(attached); IDirectDrawSurface7_Release(attached);
@ -5859,7 +5867,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
if (d3d_surface->isRenderTarget) if (d3d_surface->isRenderTarget)
{ {
IDirectDrawSurface7_EnumAttachedSurfaces((IDirectDrawSurface7 *)d3d_surface, &target, findRenderTarget); IDirectDrawSurface7_EnumAttachedSurfaces(&d3d_surface->IDirectDrawSurface7_iface, &target, findRenderTarget);
} }
else else
{ {
@ -5928,7 +5936,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa
ddraw_surface = impl_from_IDirectDrawSurface7(ddraw7); ddraw_surface = impl_from_IDirectDrawSurface7(ddraw7);
*surface = ddraw_surface->wined3d_surface; *surface = ddraw_surface->wined3d_surface;
wined3d_surface_incref(*surface); wined3d_surface_incref(*surface);
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)ddraw_surface); IDirectDrawSurface7_Release(&ddraw_surface->IDirectDrawSurface7_iface);
return D3D_OK; return D3D_OK;
} }

View File

@ -152,7 +152,7 @@ extern WINED3DSURFTYPE DefaultSurfaceType DECLSPEC_HIDDEN;
struct IDirectDrawSurfaceImpl struct IDirectDrawSurfaceImpl
{ {
/* IUnknown fields */ /* IUnknown fields */
const IDirectDrawSurface7Vtbl *lpVtbl; IDirectDrawSurface7 IDirectDrawSurface7_iface;
IDirectDrawSurface3 IDirectDrawSurface3_iface; IDirectDrawSurface3 IDirectDrawSurface3_iface;
const IDirectDrawGammaControlVtbl *IDirectDrawGammaControl_vtbl; const IDirectDrawGammaControlVtbl *IDirectDrawGammaControl_vtbl;
const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl; const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl;
@ -227,7 +227,7 @@ static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface3(IDirectDrawS
static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface) static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
{ {
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, lpVtbl); return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface7_iface);
} }
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface) DECLSPEC_HIDDEN; IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface) DECLSPEC_HIDDEN;

View File

@ -359,8 +359,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
/* Release the render target and the WineD3D render target /* Release the render target and the WineD3D render target
* (See IDirect3D7::CreateDevice for more comments on this) * (See IDirect3D7::CreateDevice for more comments on this)
*/ */
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This->target); IDirectDrawSurface7_Release(&This->target->IDirectDrawSurface7_iface);
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This->ddraw->d3d_target); IDirectDrawSurface7_Release(&This->ddraw->d3d_target->IDirectDrawSurface7_iface);
TRACE("Target release done\n"); TRACE("Target release done\n");
This->ddraw->d3ddevice = NULL; This->ddraw->d3ddevice = NULL;
@ -1855,7 +1855,7 @@ IDirect3DDeviceImpl_7_SetRenderTarget(IDirect3DDevice7 *iface,
return hr; return hr;
} }
IDirectDrawSurface7_AddRef(NewTarget); IDirectDrawSurface7_AddRef(NewTarget);
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This->target); IDirectDrawSurface7_Release(&This->target->IDirectDrawSurface7_iface);
This->target = Target; This->target = Target;
IDirect3DDeviceImpl_UpdateDepthStencil(This); IDirect3DDeviceImpl_UpdateDepthStencil(This);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
@ -1893,7 +1893,8 @@ static HRESULT WINAPI IDirect3DDeviceImpl_3_SetRenderTarget(IDirect3DDevice3 *if
TRACE("iface %p, target %p, flags %#x.\n", iface, NewRenderTarget, Flags); TRACE("iface %p, target %p, flags %#x.\n", iface, NewRenderTarget, Flags);
return IDirect3DDevice7_SetRenderTarget((IDirect3DDevice7 *)This, (IDirectDrawSurface7 *)Target, Flags); return IDirect3DDevice7_SetRenderTarget((IDirect3DDevice7 *)This,
Target ? &Target->IDirectDrawSurface7_iface : NULL, Flags);
} }
static HRESULT WINAPI IDirect3DDeviceImpl_2_SetRenderTarget(IDirect3DDevice2 *iface, static HRESULT WINAPI IDirect3DDeviceImpl_2_SetRenderTarget(IDirect3DDevice2 *iface,
@ -1904,7 +1905,8 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_SetRenderTarget(IDirect3DDevice2 *if
TRACE("iface %p, target %p, flags %#x.\n", iface, NewRenderTarget, Flags); TRACE("iface %p, target %p, flags %#x.\n", iface, NewRenderTarget, Flags);
return IDirect3DDevice7_SetRenderTarget((IDirect3DDevice7 *)This, (IDirectDrawSurface7 *)Target, Flags); return IDirect3DDevice7_SetRenderTarget((IDirect3DDevice7 *)This,
Target ? &Target->IDirectDrawSurface7_iface : NULL, Flags);
} }
/***************************************************************************** /*****************************************************************************
@ -1936,7 +1938,7 @@ IDirect3DDeviceImpl_7_GetRenderTarget(IDirect3DDevice7 *iface,
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
*RenderTarget = (IDirectDrawSurface7 *)This->target; *RenderTarget = &This->target->IDirectDrawSurface7_iface;
IDirectDrawSurface7_AddRef(*RenderTarget); IDirectDrawSurface7_AddRef(*RenderTarget);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
@ -4584,7 +4586,7 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
if (This->legacyTextureBlending) if (This->legacyTextureBlending)
IDirect3DDevice3_GetRenderState(iface, D3DRENDERSTATE_TEXTUREMAPBLEND, &texmapblend); IDirect3DDevice3_GetRenderState(iface, D3DRENDERSTATE_TEXTUREMAPBLEND, &texmapblend);
hr = IDirect3DDevice7_SetTexture((IDirect3DDevice7 *)This, Stage, (IDirectDrawSurface7 *)tex); hr = IDirect3DDevice7_SetTexture((IDirect3DDevice7 *)This, Stage, &tex->IDirectDrawSurface7_iface);
if (This->legacyTextureBlending && texmapblend == D3DTBLEND_MODULATE) if (This->legacyTextureBlending && texmapblend == D3DTBLEND_MODULATE)
{ {
@ -5876,24 +5878,24 @@ static BOOL is_mip_level_subset(IDirectDrawSurfaceImpl *dest,
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)dest_level, &ddsd.ddsCaps, &temp); IDirectDrawSurface7_GetAttachedSurface(&dest_level->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
if (dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level); if (dest_level != dest) IDirectDrawSurface7_Release(&dest_level->IDirectDrawSurface7_iface);
dest_level = unsafe_impl_from_IDirectDrawSurface7(temp); dest_level = unsafe_impl_from_IDirectDrawSurface7(temp);
} }
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)src_level, &ddsd.ddsCaps, &temp); IDirectDrawSurface7_GetAttachedSurface(&src_level->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
if (src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level); if (src_level != src) IDirectDrawSurface7_Release(&src_level->IDirectDrawSurface7_iface);
src_level = unsafe_impl_from_IDirectDrawSurface7(temp); src_level = unsafe_impl_from_IDirectDrawSurface7(temp);
} }
if (src_level && src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level); if (src_level && src_level != src) IDirectDrawSurface7_Release(&src_level->IDirectDrawSurface7_iface);
if (dest_level && dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level); if (dest_level && dest_level != dest) IDirectDrawSurface7_Release(&dest_level->IDirectDrawSurface7_iface);
return !dest_level && levelFound; return !dest_level && levelFound;
} }
@ -5917,8 +5919,8 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
BOOL palette_missing = FALSE; BOOL palette_missing = FALSE;
/* Copy palette, if possible. */ /* Copy palette, if possible. */
IDirectDrawSurface7_GetPalette((IDirectDrawSurface7 *)src, &pal_src); IDirectDrawSurface7_GetPalette(&src->IDirectDrawSurface7_iface, &pal_src);
IDirectDrawSurface7_GetPalette((IDirectDrawSurface7 *)dest, &pal); IDirectDrawSurface7_GetPalette(&dest->IDirectDrawSurface7_iface, &pal);
if (pal_src != NULL && pal != NULL) if (pal_src != NULL && pal != NULL)
{ {
@ -5940,11 +5942,11 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
/* Copy colorkeys, if present. */ /* Copy colorkeys, if present. */
for (ckeyflag = DDCKEY_DESTBLT; ckeyflag <= DDCKEY_SRCOVERLAY; ckeyflag <<= 1) for (ckeyflag = DDCKEY_DESTBLT; ckeyflag <= DDCKEY_SRCOVERLAY; ckeyflag <<= 1)
{ {
hr = IDirectDrawSurface7_GetColorKey((IDirectDrawSurface7 *)src, ckeyflag, &ddckey); hr = IDirectDrawSurface7_GetColorKey(&src->IDirectDrawSurface7_iface, ckeyflag, &ddckey);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
IDirectDrawSurface7_SetColorKey((IDirectDrawSurface7 *)dest, ckeyflag, &ddckey); IDirectDrawSurface7_SetColorKey(&dest->IDirectDrawSurface7_iface, ckeyflag, &ddckey);
} }
} }
@ -5977,18 +5979,18 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)dest_level, &ddsd.ddsCaps, &temp); IDirectDrawSurface7_GetAttachedSurface(&dest_level->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
if (dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level); if (dest_level != dest) IDirectDrawSurface7_Release(&dest_level->IDirectDrawSurface7_iface);
dest_level = unsafe_impl_from_IDirectDrawSurface7(temp); dest_level = unsafe_impl_from_IDirectDrawSurface7(temp);
} }
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)src_level, &ddsd.ddsCaps, &temp); IDirectDrawSurface7_GetAttachedSurface(&src_level->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
if (src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level); if (src_level != src) IDirectDrawSurface7_Release(&src_level->IDirectDrawSurface7_iface);
src_level = unsafe_impl_from_IDirectDrawSurface7(temp); src_level = unsafe_impl_from_IDirectDrawSurface7(temp);
@ -6001,8 +6003,8 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
rect.bottom = (rect.bottom + 1) / 2; rect.bottom = (rect.bottom + 1) / 2;
} }
if (src_level && src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level); if (src_level && src_level != src) IDirectDrawSurface7_Release(&src_level->IDirectDrawSurface7_iface);
if (dest_level && dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level); if (dest_level && dest_level != dest) IDirectDrawSurface7_Release(&dest_level->IDirectDrawSurface7_iface);
} }
/***************************************************************************** /*****************************************************************************
@ -6136,15 +6138,15 @@ IDirect3DDeviceImpl_7_Load(IDirect3DDevice7 *iface,
{ {
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | (src_face_flag << 1); ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | (src_face_flag << 1);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)src, &ddsd.ddsCaps, &temp); IDirectDrawSurface7_GetAttachedSurface(&src->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
if (src_face != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_face); if (src_face != src) IDirectDrawSurface7_Release(&src_face->IDirectDrawSurface7_iface);
src_face = unsafe_impl_from_IDirectDrawSurface7(temp); src_face = unsafe_impl_from_IDirectDrawSurface7(temp);
} }
else else
{ {
if (src_face != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_face); if (src_face != src) IDirectDrawSurface7_Release(&src_face->IDirectDrawSurface7_iface);
src_face = NULL; src_face = NULL;
} }
@ -6154,15 +6156,15 @@ IDirect3DDeviceImpl_7_Load(IDirect3DDevice7 *iface,
{ {
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | (dest_face_flag << 1); ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | (dest_face_flag << 1);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)dest, &ddsd.ddsCaps, &temp); IDirectDrawSurface7_GetAttachedSurface(&dest->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
if (dest_face != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_face); if (dest_face != dest) IDirectDrawSurface7_Release(&dest_face->IDirectDrawSurface7_iface);
dest_face = unsafe_impl_from_IDirectDrawSurface7(temp); dest_face = unsafe_impl_from_IDirectDrawSurface7(temp);
} }
else else
{ {
if (dest_face != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_face); if (dest_face != dest) IDirectDrawSurface7_Release(&dest_face->IDirectDrawSurface7_iface);
dest_face = NULL; dest_face = NULL;
} }
@ -6754,7 +6756,7 @@ IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This)
IDirectDrawSurfaceImpl *dsi; IDirectDrawSurfaceImpl *dsi;
static DDSCAPS2 depthcaps = { DDSCAPS_ZBUFFER, 0, 0, 0 }; static DDSCAPS2 depthcaps = { DDSCAPS_ZBUFFER, 0, 0, 0 };
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)This->target, &depthcaps, &depthStencil); IDirectDrawSurface7_GetAttachedSurface(&This->target->IDirectDrawSurface7_iface, &depthcaps, &depthStencil);
if(!depthStencil) if(!depthStencil)
{ {
TRACE("Setting wined3d depth stencil to NULL\n"); TRACE("Setting wined3d depth stencil to NULL\n");
@ -6829,8 +6831,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
* *
* In most cases, those surfaces are the same anyway, but this will simply * In most cases, those surfaces are the same anyway, but this will simply
* add another ref which is released when the device is destroyed. */ * add another ref which is released when the device is destroyed. */
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)target); IDirectDrawSurface7_AddRef(&target->IDirectDrawSurface7_iface);
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)ddraw->d3d_target); IDirectDrawSurface7_AddRef(&ddraw->d3d_target->IDirectDrawSurface7_iface);
ddraw->d3ddevice = device; ddraw->d3ddevice = device;

View File

@ -102,7 +102,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
IDirect3DDevice7 *d3d; IDirect3DDevice7 *d3d;
/* Call into IDirect3D7 for creation */ /* Call into IDirect3D7 for creation */
IDirect3D7_CreateDevice(&This->ddraw->IDirect3D7_iface, riid, (IDirectDrawSurface7 *)This, IDirect3D7_CreateDevice(&This->ddraw->IDirect3D7_iface, riid, &This->IDirectDrawSurface7_iface,
&d3d); &d3d);
if (d3d) if (d3d)
@ -141,7 +141,7 @@ static HRESULT WINAPI ddraw_surface3_QueryInterface(IDirectDrawSurface3 *iface,
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
return ddraw_surface7_QueryInterface((IDirectDrawSurface7 *)This, riid, object); return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object);
} }
static HRESULT WINAPI ddraw_gamma_control_QueryInterface(IDirectDrawGammaControl *iface, REFIID riid, void **object) static HRESULT WINAPI ddraw_gamma_control_QueryInterface(IDirectDrawGammaControl *iface, REFIID riid, void **object)
@ -149,7 +149,7 @@ static HRESULT WINAPI ddraw_gamma_control_QueryInterface(IDirectDrawGammaControl
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface); IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
return ddraw_surface7_QueryInterface((IDirectDrawSurface7 *)This, riid, object); return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object);
} }
static HRESULT WINAPI d3d_texture2_QueryInterface(IDirect3DTexture2 *iface, REFIID riid, void **object) static HRESULT WINAPI d3d_texture2_QueryInterface(IDirect3DTexture2 *iface, REFIID riid, void **object)
@ -157,7 +157,7 @@ static HRESULT WINAPI d3d_texture2_QueryInterface(IDirect3DTexture2 *iface, REFI
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface); IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
return ddraw_surface7_QueryInterface((IDirectDrawSurface7 *)This, riid, object); return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object);
} }
static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFIID riid, void **object) static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFIID riid, void **object)
@ -165,7 +165,7 @@ static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFII
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface); IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
return ddraw_surface7_QueryInterface((IDirectDrawSurface7 *)This, riid, object); return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object);
} }
/***************************************************************************** /*****************************************************************************
@ -202,7 +202,7 @@ static ULONG WINAPI ddraw_surface3_AddRef(IDirectDrawSurface3 *iface)
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_AddRef((IDirectDrawSurface7 *)This); return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface);
} }
static ULONG WINAPI ddraw_gamma_control_AddRef(IDirectDrawGammaControl *iface) static ULONG WINAPI ddraw_gamma_control_AddRef(IDirectDrawGammaControl *iface)
@ -210,7 +210,7 @@ static ULONG WINAPI ddraw_gamma_control_AddRef(IDirectDrawGammaControl *iface)
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface); IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_AddRef((IDirectDrawSurface7 *)This); return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface);
} }
static ULONG WINAPI d3d_texture2_AddRef(IDirect3DTexture2 *iface) static ULONG WINAPI d3d_texture2_AddRef(IDirect3DTexture2 *iface)
@ -218,7 +218,7 @@ static ULONG WINAPI d3d_texture2_AddRef(IDirect3DTexture2 *iface)
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface); IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_AddRef((IDirectDrawSurface7 *)This); return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface);
} }
static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface) static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface)
@ -226,7 +226,7 @@ static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface)
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface); IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_AddRef((IDirectDrawSurface7 *)This); return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface);
} }
/***************************************************************************** /*****************************************************************************
@ -320,7 +320,7 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
/* The refcount test shows that the palette is detached when the surface /* The refcount test shows that the palette is detached when the surface
* is destroyed. */ * is destroyed. */
IDirectDrawSurface7_SetPalette((IDirectDrawSurface7 *)surface, NULL); IDirectDrawSurface7_SetPalette(&surface->IDirectDrawSurface7_iface, NULL);
/* Loop through all complex attached surfaces and destroy them. /* Loop through all complex attached surfaces and destroy them.
* *
@ -412,7 +412,7 @@ static ULONG WINAPI ddraw_surface3_Release(IDirectDrawSurface3 *iface)
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_Release((IDirectDrawSurface7 *)This); return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface);
} }
static ULONG WINAPI ddraw_gamma_control_Release(IDirectDrawGammaControl *iface) static ULONG WINAPI ddraw_gamma_control_Release(IDirectDrawGammaControl *iface)
@ -420,7 +420,7 @@ static ULONG WINAPI ddraw_gamma_control_Release(IDirectDrawGammaControl *iface)
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface); IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_Release((IDirectDrawSurface7 *)This); return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface);
} }
static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface) static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface)
@ -428,7 +428,7 @@ static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface)
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface); IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_Release((IDirectDrawSurface7 *)This); return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface);
} }
static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface) static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface)
@ -436,7 +436,7 @@ static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface)
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface); IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_Release((IDirectDrawSurface7 *)This); return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface);
} }
/***************************************************************************** /*****************************************************************************
@ -518,7 +518,7 @@ static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *ifa
TRACE("(%p): Returning surface %p\n", This, surf); TRACE("(%p): Returning surface %p\n", This, surf);
TRACE("(%p): mipmapcount=%d\n", This, surf->mipmap_level); TRACE("(%p): mipmapcount=%d\n", This, surf->mipmap_level);
*Surface = (IDirectDrawSurface7 *)surf; *Surface = &surf->IDirectDrawSurface7_iface;
ddraw_surface7_AddRef(*Surface); ddraw_surface7_AddRef(*Surface);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -543,7 +543,7 @@ static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *ifa
((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) { ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) {
TRACE("(%p): Returning surface %p\n", This, surf); TRACE("(%p): Returning surface %p\n", This, surf);
*Surface = (IDirectDrawSurface7 *)surf; *Surface = &surf->IDirectDrawSurface7_iface;
ddraw_surface7_AddRef(*Surface); ddraw_surface7_AddRef(*Surface);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -573,7 +573,7 @@ static HRESULT WINAPI ddraw_surface3_GetAttachedSurface(IDirectDrawSurface3 *ifa
caps2.dwCaps3 = 0; caps2.dwCaps3 = 0;
caps2.dwCaps4 = 0; caps2.dwCaps4 = 0;
hr = ddraw_surface7_GetAttachedSurface((IDirectDrawSurface7 *)This, hr = ddraw_surface7_GetAttachedSurface(&This->IDirectDrawSurface7_iface,
&caps2, &attachment7); &caps2, &attachment7);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -689,7 +689,7 @@ static HRESULT WINAPI ddraw_surface3_Lock(IDirectDrawSurface3 *iface, RECT *rect
TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n", TRACE("iface %p, rect %s, surface_desc %p, flags %#x, h %p.\n",
iface, wine_dbgstr_rect(rect), surface_desc, flags, h); iface, wine_dbgstr_rect(rect), surface_desc, flags, h);
return ddraw_surface7_Lock((IDirectDrawSurface7 *)This, return ddraw_surface7_Lock(&This->IDirectDrawSurface7_iface,
rect, (DDSURFACEDESC2 *)surface_desc, flags, h); rect, (DDSURFACEDESC2 *)surface_desc, flags, h);
} }
@ -729,7 +729,7 @@ static HRESULT WINAPI ddraw_surface3_Unlock(IDirectDrawSurface3 *iface, void *da
TRACE("iface %p, data %p.\n", iface, data); TRACE("iface %p, data %p.\n", iface, data);
/* data might not be the LPRECT of later versions, so drop it. */ /* data might not be the LPRECT of later versions, so drop it. */
return ddraw_surface7_Unlock((IDirectDrawSurface7 *)This, NULL); return ddraw_surface7_Unlock(&This->IDirectDrawSurface7_iface, NULL);
} }
/***************************************************************************** /*****************************************************************************
@ -799,8 +799,8 @@ static HRESULT WINAPI ddraw_surface3_Flip(IDirectDrawSurface3 *iface, IDirectDra
IDirectDrawSurfaceImpl *dst_impl = unsafe_impl_from_IDirectDrawSurface3(dst); IDirectDrawSurfaceImpl *dst_impl = unsafe_impl_from_IDirectDrawSurface3(dst);
TRACE("iface %p, dst %p, flags %#x.\n", iface, dst, flags); TRACE("iface %p, dst %p, flags %#x.\n", iface, dst, flags);
return ddraw_surface7_Flip((IDirectDrawSurface7 *)This, return ddraw_surface7_Flip(&This->IDirectDrawSurface7_iface,
dst_impl ? (IDirectDrawSurface7 *)dst_impl : NULL, flags); dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -898,8 +898,8 @@ static HRESULT WINAPI ddraw_surface3_Blt(IDirectDrawSurface3 *iface, RECT *dst_r
TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n", TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx); iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx);
return ddraw_surface7_Blt((IDirectDrawSurface7 *)This, dst_rect, return ddraw_surface7_Blt(&This->IDirectDrawSurface7_iface, dst_rect,
src_impl ? (IDirectDrawSurface7 *)src_impl : NULL, src_rect, flags, fx); src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags, fx);
} }
/***************************************************************************** /*****************************************************************************
@ -979,7 +979,7 @@ static HRESULT ddraw_surface_attach_surface(IDirectDrawSurfaceImpl *This, IDirec
IDirect3DDeviceImpl_UpdateDepthStencil(This->ddraw->d3ddevice); IDirect3DDeviceImpl_UpdateDepthStencil(This->ddraw->d3ddevice);
} }
ddraw_surface7_AddRef((IDirectDrawSurface7 *)Surf); ddraw_surface7_AddRef(&Surf->IDirectDrawSurface7_iface);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
} }
@ -1114,8 +1114,8 @@ static HRESULT WINAPI ddraw_surface3_DeleteAttachedSurface(IDirectDrawSurface3 *
IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface3(attachment); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface3(attachment);
TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment); TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment);
return ddraw_surface7_DeleteAttachedSurface((IDirectDrawSurface7 *)This, flags, return ddraw_surface7_DeleteAttachedSurface(&This->IDirectDrawSurface7_iface, flags,
attachment_impl ? (IDirectDrawSurface7 *)attachment_impl : NULL); attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL);
} }
/***************************************************************************** /*****************************************************************************
@ -1142,7 +1142,7 @@ static HRESULT WINAPI ddraw_surface3_AddOverlayDirtyRect(IDirectDrawSurface3 *if
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect)); TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(rect));
return ddraw_surface7_AddOverlayDirtyRect((IDirectDrawSurface7 *)This, rect); return ddraw_surface7_AddOverlayDirtyRect(&This->IDirectDrawSurface7_iface, rect);
} }
/***************************************************************************** /*****************************************************************************
@ -1190,7 +1190,7 @@ static HRESULT WINAPI ddraw_surface3_GetDC(IDirectDrawSurface3 *iface, HDC *dc)
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, dc %p.\n", iface, dc); TRACE("iface %p, dc %p.\n", iface, dc);
return ddraw_surface7_GetDC((IDirectDrawSurface7 *)This, dc); return ddraw_surface7_GetDC(&This->IDirectDrawSurface7_iface, dc);
} }
/***************************************************************************** /*****************************************************************************
@ -1224,7 +1224,7 @@ static HRESULT WINAPI ddraw_surface3_ReleaseDC(IDirectDrawSurface3 *iface, HDC d
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, dc %p.\n", iface, dc); TRACE("iface %p, dc %p.\n", iface, dc);
return ddraw_surface7_ReleaseDC((IDirectDrawSurface7 *)This, dc); return ddraw_surface7_ReleaseDC(&This->IDirectDrawSurface7_iface, dc);
} }
/***************************************************************************** /*****************************************************************************
@ -1261,7 +1261,7 @@ static HRESULT WINAPI ddraw_surface3_GetCaps(IDirectDrawSurface3 *iface, DDSCAPS
TRACE("iface %p, caps %p.\n", iface, caps); TRACE("iface %p, caps %p.\n", iface, caps);
hr = ddraw_surface7_GetCaps((IDirectDrawSurface7 *)This, &caps2); hr = ddraw_surface7_GetCaps(&This->IDirectDrawSurface7_iface, &caps2);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
caps->dwCaps = caps2.dwCaps; caps->dwCaps = caps2.dwCaps;
@ -1445,7 +1445,7 @@ static HRESULT WINAPI ddraw_surface3_PageLock(IDirectDrawSurface3 *iface, DWORD
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, flags %#x.\n", iface, flags); TRACE("iface %p, flags %#x.\n", iface, flags);
return ddraw_surface7_PageLock((IDirectDrawSurface7 *)This, flags); return ddraw_surface7_PageLock(&This->IDirectDrawSurface7_iface, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -1472,7 +1472,7 @@ static HRESULT WINAPI ddraw_surface3_PageUnlock(IDirectDrawSurface3 *iface, DWOR
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, flags %#x.\n", iface, flags); TRACE("iface %p, flags %#x.\n", iface, flags);
return ddraw_surface7_PageUnlock((IDirectDrawSurface7 *)This, flags); return ddraw_surface7_PageUnlock(&This->IDirectDrawSurface7_iface, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -1500,7 +1500,7 @@ static HRESULT WINAPI ddraw_surface3_BltBatch(IDirectDrawSurface3 *iface, DDBLTB
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, batch, count, flags); TRACE("iface %p, batch %p, count %u, flags %#x.\n", iface, batch, count, flags);
return ddraw_surface7_BltBatch((IDirectDrawSurface7 *)This, batch, count, flags); return ddraw_surface7_BltBatch(&This->IDirectDrawSurface7_iface, batch, count, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -1537,10 +1537,10 @@ static HRESULT WINAPI ddraw_surface7_EnumAttachedSurfaces(IDirectDrawSurface7 *i
surf = This->complex_array[i]; surf = This->complex_array[i];
if(!surf) break; if(!surf) break;
ddraw_surface7_AddRef((IDirectDrawSurface7 *)surf); ddraw_surface7_AddRef(&surf->IDirectDrawSurface7_iface);
desc = surf->surface_desc; desc = surf->surface_desc;
/* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */ /* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
if (cb((IDirectDrawSurface7 *)surf, &desc, context) == DDENUMRET_CANCEL) if (cb(&surf->IDirectDrawSurface7_iface, &desc, context) == DDENUMRET_CANCEL)
{ {
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -1549,10 +1549,10 @@ static HRESULT WINAPI ddraw_surface7_EnumAttachedSurfaces(IDirectDrawSurface7 *i
for (surf = This->next_attached; surf != NULL; surf = surf->next_attached) for (surf = This->next_attached; surf != NULL; surf = surf->next_attached)
{ {
ddraw_surface7_AddRef((IDirectDrawSurface7 *)surf); ddraw_surface7_AddRef(&surf->IDirectDrawSurface7_iface);
desc = surf->surface_desc; desc = surf->surface_desc;
/* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */ /* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
if (cb((IDirectDrawSurface7 *)surf, &desc, context) == DDENUMRET_CANCEL) if (cb(&surf->IDirectDrawSurface7_iface, &desc, context) == DDENUMRET_CANCEL)
{ {
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -1591,7 +1591,7 @@ static HRESULT WINAPI ddraw_surface3_EnumAttachedSurfaces(IDirectDrawSurface3 *i
info.callback = callback; info.callback = callback;
info.context = context; info.context = context;
return ddraw_surface7_EnumAttachedSurfaces((IDirectDrawSurface7 *)This, return ddraw_surface7_EnumAttachedSurfaces(&This->IDirectDrawSurface7_iface,
&info, EnumCallback); &info, EnumCallback);
} }
@ -1628,7 +1628,7 @@ static HRESULT WINAPI ddraw_surface3_EnumOverlayZOrders(IDirectDrawSurface3 *ifa
info.callback = callback; info.callback = callback;
info.context = context; info.context = context;
return ddraw_surface7_EnumOverlayZOrders((IDirectDrawSurface7 *)This, return ddraw_surface7_EnumOverlayZOrders(&This->IDirectDrawSurface7_iface,
flags, &info, EnumCallback); flags, &info, EnumCallback);
} }
@ -1666,7 +1666,7 @@ static HRESULT WINAPI ddraw_surface3_GetBltStatus(IDirectDrawSurface3 *iface, DW
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, flags %#x.\n", iface, flags); TRACE("iface %p, flags %#x.\n", iface, flags);
return ddraw_surface7_GetBltStatus((IDirectDrawSurface7 *)This, flags); return ddraw_surface7_GetBltStatus(&This->IDirectDrawSurface7_iface, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -1746,7 +1746,7 @@ static HRESULT WINAPI ddraw_surface3_GetColorKey(IDirectDrawSurface3 *iface, DWO
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key); TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
return ddraw_surface7_GetColorKey((IDirectDrawSurface7 *)This, flags, color_key); return ddraw_surface7_GetColorKey(&This->IDirectDrawSurface7_iface, flags, color_key);
} }
/***************************************************************************** /*****************************************************************************
@ -1783,7 +1783,7 @@ static HRESULT WINAPI ddraw_surface3_GetFlipStatus(IDirectDrawSurface3 *iface, D
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, flags %#x.\n", iface, flags); TRACE("iface %p, flags %#x.\n", iface, flags);
return ddraw_surface7_GetFlipStatus((IDirectDrawSurface7 *)This, flags); return ddraw_surface7_GetFlipStatus(&This->IDirectDrawSurface7_iface, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -1816,7 +1816,7 @@ static HRESULT WINAPI ddraw_surface3_GetOverlayPosition(IDirectDrawSurface3 *ifa
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, x %p, y %p.\n", iface, x, y); TRACE("iface %p, x %p, y %p.\n", iface, x, y);
return ddraw_surface7_GetOverlayPosition((IDirectDrawSurface7 *)This, x, y); return ddraw_surface7_GetOverlayPosition(&This->IDirectDrawSurface7_iface, x, y);
} }
/***************************************************************************** /*****************************************************************************
@ -1855,7 +1855,7 @@ static HRESULT WINAPI ddraw_surface3_GetPixelFormat(IDirectDrawSurface3 *iface,
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, pixel_format %p.\n", iface, pixel_format); TRACE("iface %p, pixel_format %p.\n", iface, pixel_format);
return ddraw_surface7_GetPixelFormat((IDirectDrawSurface7 *)This, pixel_format); return ddraw_surface7_GetPixelFormat(&This->IDirectDrawSurface7_iface, pixel_format);
} }
/***************************************************************************** /*****************************************************************************
@ -1950,7 +1950,7 @@ static HRESULT WINAPI ddraw_surface3_Initialize(IDirectDrawSurface3 *iface,
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc); TRACE("iface %p, ddraw %p, surface_desc %p.\n", iface, ddraw, surface_desc);
return ddraw_surface7_Initialize((IDirectDrawSurface7 *)This, return ddraw_surface7_Initialize(&This->IDirectDrawSurface7_iface,
ddraw, (DDSURFACEDESC2 *)surface_desc); ddraw, (DDSURFACEDESC2 *)surface_desc);
} }
@ -2022,7 +2022,7 @@ static HRESULT WINAPI ddraw_surface3_IsLost(IDirectDrawSurface3 *iface)
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_IsLost((IDirectDrawSurface7 *)This); return ddraw_surface7_IsLost(&This->IDirectDrawSurface7_iface);
} }
/***************************************************************************** /*****************************************************************************
@ -2060,7 +2060,7 @@ static HRESULT WINAPI ddraw_surface3_Restore(IDirectDrawSurface3 *iface)
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface7_Restore((IDirectDrawSurface7 *)This); return ddraw_surface7_Restore(&This->IDirectDrawSurface7_iface);
} }
/***************************************************************************** /*****************************************************************************
@ -2093,7 +2093,7 @@ static HRESULT WINAPI ddraw_surface3_SetOverlayPosition(IDirectDrawSurface3 *ifa
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, x %d, y %d.\n", iface, x, y); TRACE("iface %p, x %d, y %d.\n", iface, x, y);
return ddraw_surface7_SetOverlayPosition((IDirectDrawSurface7 *)This, x, y); return ddraw_surface7_SetOverlayPosition(&This->IDirectDrawSurface7_iface, x, y);
} }
/***************************************************************************** /*****************************************************************************
@ -2142,8 +2142,8 @@ static HRESULT WINAPI ddraw_surface3_UpdateOverlay(IDirectDrawSurface3 *iface, R
TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n", TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx); iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
return ddraw_surface7_UpdateOverlay((IDirectDrawSurface7 *)This, src_rect, return ddraw_surface7_UpdateOverlay(&This->IDirectDrawSurface7_iface, src_rect,
dst_impl ? (IDirectDrawSurface7 *)dst_impl : NULL, dst_rect, flags, fx); dst_impl ? &dst_impl->IDirectDrawSurface7_iface : NULL, dst_rect, flags, fx);
} }
/***************************************************************************** /*****************************************************************************
@ -2169,7 +2169,7 @@ static HRESULT WINAPI ddraw_surface3_UpdateOverlayDisplay(IDirectDrawSurface3 *i
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, flags %#x.\n", iface, flags); TRACE("iface %p, flags %#x.\n", iface, flags);
return ddraw_surface7_UpdateOverlayDisplay((IDirectDrawSurface7 *)This, flags); return ddraw_surface7_UpdateOverlayDisplay(&This->IDirectDrawSurface7_iface, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -2208,8 +2208,8 @@ static HRESULT WINAPI ddraw_surface3_UpdateOverlayZOrder(IDirectDrawSurface3 *if
IDirectDrawSurfaceImpl *reference_impl = unsafe_impl_from_IDirectDrawSurface3(reference); IDirectDrawSurfaceImpl *reference_impl = unsafe_impl_from_IDirectDrawSurface3(reference);
TRACE("iface %p, flags %#x, reference %p.\n", iface, flags, reference); TRACE("iface %p, flags %#x, reference %p.\n", iface, flags, reference);
return ddraw_surface7_UpdateOverlayZOrder((IDirectDrawSurface7 *)This, flags, return ddraw_surface7_UpdateOverlayZOrder(&This->IDirectDrawSurface7_iface, flags,
reference_impl ? (IDirectDrawSurface7 *)reference_impl : NULL); reference_impl ? &reference_impl->IDirectDrawSurface7_iface : NULL);
} }
/***************************************************************************** /*****************************************************************************
@ -2264,7 +2264,7 @@ static HRESULT WINAPI ddraw_surface3_GetDDInterface(IDirectDrawSurface3 *iface,
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, ddraw %p.\n", iface, ddraw); TRACE("iface %p, ddraw %p.\n", iface, ddraw);
return ddraw_surface7_GetDDInterface((IDirectDrawSurface7 *)This, ddraw); return ddraw_surface7_GetDDInterface(&This->IDirectDrawSurface7_iface, ddraw);
} }
/* This seems also windows implementation specific - I don't think WineD3D needs this */ /* This seems also windows implementation specific - I don't think WineD3D needs this */
@ -2464,8 +2464,8 @@ static HRESULT WINAPI ddraw_surface3_BltFast(IDirectDrawSurface3 *iface, DWORD d
TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n", TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), flags); iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), flags);
return ddraw_surface7_BltFast((IDirectDrawSurface7 *)This, dst_x, dst_y, return ddraw_surface7_BltFast(&This->IDirectDrawSurface7_iface, dst_x, dst_y,
src_impl ? (IDirectDrawSurface7 *)src_impl : NULL, src_rect, flags); src_impl ? &src_impl->IDirectDrawSurface7_iface : NULL, src_rect, flags);
} }
/***************************************************************************** /*****************************************************************************
@ -2513,7 +2513,7 @@ static HRESULT WINAPI ddraw_surface3_GetClipper(IDirectDrawSurface3 *iface, IDir
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, clipper %p.\n", iface, clipper); TRACE("iface %p, clipper %p.\n", iface, clipper);
return ddraw_surface7_GetClipper((IDirectDrawSurface7 *)This, clipper); return ddraw_surface7_GetClipper(&This->IDirectDrawSurface7_iface, clipper);
} }
/***************************************************************************** /*****************************************************************************
@ -2576,7 +2576,7 @@ static HRESULT WINAPI ddraw_surface3_SetClipper(IDirectDrawSurface3 *iface, IDir
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, clipper %p.\n", iface, clipper); TRACE("iface %p, clipper %p.\n", iface, clipper);
return ddraw_surface7_SetClipper((IDirectDrawSurface7 *)This, clipper); return ddraw_surface7_SetClipper(&This->IDirectDrawSurface7_iface, clipper);
} }
/***************************************************************************** /*****************************************************************************
@ -2676,7 +2676,7 @@ static HRESULT WINAPI ddraw_surface3_SetSurfaceDesc(IDirectDrawSurface3 *iface,
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, surface_desc %p, flags %#x.\n", iface, surface_desc, flags); TRACE("iface %p, surface_desc %p, flags %#x.\n", iface, surface_desc, flags);
return ddraw_surface7_SetSurfaceDesc((IDirectDrawSurface7 *)This, return ddraw_surface7_SetSurfaceDesc(&This->IDirectDrawSurface7_iface,
(DDSURFACEDESC2 *)surface_desc, flags); (DDSURFACEDESC2 *)surface_desc, flags);
} }
@ -2727,7 +2727,7 @@ static HRESULT WINAPI ddraw_surface3_GetPalette(IDirectDrawSurface3 *iface, IDir
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, palette %p.\n", iface, palette); TRACE("iface %p, palette %p.\n", iface, palette);
return ddraw_surface7_GetPalette((IDirectDrawSurface7 *)This, palette); return ddraw_surface7_GetPalette(&This->IDirectDrawSurface7_iface, palette);
} }
/***************************************************************************** /*****************************************************************************
@ -2865,7 +2865,7 @@ static HRESULT WINAPI ddraw_surface3_SetColorKey(IDirectDrawSurface3 *iface, DWO
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key); TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
return ddraw_surface7_SetColorKey((IDirectDrawSurface7 *)This, flags, color_key); return ddraw_surface7_SetColorKey(&This->IDirectDrawSurface7_iface, flags, color_key);
} }
/***************************************************************************** /*****************************************************************************
@ -2926,7 +2926,7 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir
{ {
IDirectDrawSurface7 *attach; IDirectDrawSurface7 *attach;
HRESULT hr; HRESULT hr;
hr = ddraw_surface7_GetAttachedSurface((IDirectDrawSurface7 *)surf, &caps2, &attach); hr = ddraw_surface7_GetAttachedSurface(&surf->IDirectDrawSurface7_iface, &caps2, &attach);
if(hr != DD_OK) if(hr != DD_OK)
{ {
break; break;
@ -2948,7 +2948,7 @@ static HRESULT WINAPI ddraw_surface3_SetPalette(IDirectDrawSurface3 *iface, IDir
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface);
TRACE("iface %p, palette %p.\n", iface, palette); TRACE("iface %p, palette %p.\n", iface, palette);
return ddraw_surface7_SetPalette((IDirectDrawSurface7 *)This, palette); return ddraw_surface7_SetPalette(&This->IDirectDrawSurface7_iface, palette);
} }
/********************************************************** /**********************************************************
@ -3151,7 +3151,7 @@ static IDirectDrawSurfaceImpl *get_sub_mimaplevel(IDirectDrawSurfaceImpl *surfac
IDirectDrawSurface7 *next_level; IDirectDrawSurface7 *next_level;
HRESULT hr; HRESULT hr;
hr = ddraw_surface7_GetAttachedSurface((IDirectDrawSurface7 *)surface, &mipmap_caps, &next_level); hr = ddraw_surface7_GetAttachedSurface(&surface->IDirectDrawSurface7_iface, &mipmap_caps, &next_level);
if (FAILED(hr)) return NULL; if (FAILED(hr)) return NULL;
ddraw_surface7_Release(next_level); ddraw_surface7_Release(next_level);
@ -3462,7 +3462,7 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7
{ {
if (!iface) return NULL; if (!iface) return NULL;
assert(iface->lpVtbl == &ddraw_surface7_vtbl); assert(iface->lpVtbl == &ddraw_surface7_vtbl);
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, lpVtbl); return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface7_iface);
} }
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface) IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface)
@ -3481,8 +3481,8 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
/* Check for attached surfaces and detach them. */ /* Check for attached surfaces and detach them. */
if (surface->first_attached != surface) if (surface->first_attached != surface)
{ {
IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)surface->first_attached; IDirectDrawSurface7 *root = &surface->first_attached->IDirectDrawSurface7_iface;
IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)surface; IDirectDrawSurface7 *detach = &surface->IDirectDrawSurface7_iface;
/* Well, this shouldn't happen: The surface being attached is /* Well, this shouldn't happen: The surface being attached is
* referenced in AddAttachedSurface(), so it shouldn't be released * referenced in AddAttachedSurface(), so it shouldn't be released
@ -3498,8 +3498,8 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
while (surface->next_attached) while (surface->next_attached)
{ {
IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)surface; IDirectDrawSurface7 *root = &surface->IDirectDrawSurface7_iface;
IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)surface->next_attached; IDirectDrawSurface7 *detach = &surface->next_attached->IDirectDrawSurface7_iface;
if (FAILED(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach))) if (FAILED(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach)))
ERR("DeleteAttachedSurface failed.\n"); ERR("DeleteAttachedSurface failed.\n");
@ -3629,7 +3629,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
return DDERR_INVALIDPIXELFORMAT; return DDERR_INVALIDPIXELFORMAT;
} }
surface->lpVtbl = &ddraw_surface7_vtbl; surface->IDirectDrawSurface7_iface.lpVtbl = &ddraw_surface7_vtbl;
surface->IDirectDrawSurface3_iface.lpVtbl = &ddraw_surface3_vtbl; surface->IDirectDrawSurface3_iface.lpVtbl = &ddraw_surface3_vtbl;
surface->IDirectDrawGammaControl_vtbl = &ddraw_gamma_control_vtbl; surface->IDirectDrawGammaControl_vtbl = &ddraw_gamma_control_vtbl;
surface->IDirect3DTexture2_vtbl = &d3d_texture2_vtbl; surface->IDirect3DTexture2_vtbl = &d3d_texture2_vtbl;