ddraw: COM cleanup for the IDirectDraw iface.
This commit is contained in:
parent
497944f2bd
commit
a59347fcd2
|
@ -46,9 +46,9 @@ const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops =
|
|||
ddraw_null_wined3d_object_destroyed,
|
||||
};
|
||||
|
||||
static inline IDirectDrawImpl *ddraw_from_ddraw1(IDirectDraw *iface)
|
||||
static inline IDirectDrawImpl *impl_from_IDirectDraw(IDirectDraw *iface)
|
||||
{
|
||||
return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw_vtbl));
|
||||
return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw_iface);
|
||||
}
|
||||
|
||||
static inline IDirectDrawImpl *ddraw_from_ddraw2(IDirectDraw2 *iface)
|
||||
|
@ -155,7 +155,7 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid,
|
|||
}
|
||||
else if ( IsEqualGUID( &IID_IDirectDraw, refiid ) )
|
||||
{
|
||||
*obj = &This->IDirectDraw_vtbl;
|
||||
*obj = &This->IDirectDraw_iface;
|
||||
TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj);
|
||||
}
|
||||
|
||||
|
@ -257,9 +257,11 @@ static HRESULT WINAPI ddraw2_QueryInterface(IDirectDraw2 *iface, REFIID riid, vo
|
|||
|
||||
static HRESULT WINAPI ddraw1_QueryInterface(IDirectDraw *iface, REFIID riid, void **object)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
||||
|
||||
return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_ddraw1(iface), riid, object);
|
||||
return ddraw7_QueryInterface((IDirectDraw7 *)This, riid, object);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d7_QueryInterface(IDirect3D7 *iface, REFIID riid, void **object)
|
||||
|
@ -366,12 +368,12 @@ static ULONG WINAPI ddraw2_AddRef(IDirectDraw2 *iface)
|
|||
|
||||
static ULONG WINAPI ddraw1_AddRef(IDirectDraw *iface)
|
||||
{
|
||||
IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface);
|
||||
ULONG ref = InterlockedIncrement(&ddraw->ref1);
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref1);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", ddraw, ref);
|
||||
TRACE("%p increasing refcount to %u.\n", This, ref);
|
||||
|
||||
if (ref == 1) InterlockedIncrement(&ddraw->numIfaces);
|
||||
if (ref == 1) InterlockedIncrement(&This->numIfaces);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -391,7 +393,7 @@ static ULONG WINAPI d3d3_AddRef(IDirect3D3 *iface)
|
|||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw1_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
|
||||
return ddraw1_AddRef(&This->IDirectDraw_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI d3d2_AddRef(IDirect3D2 *iface)
|
||||
|
@ -400,7 +402,7 @@ static ULONG WINAPI d3d2_AddRef(IDirect3D2 *iface)
|
|||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw1_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
|
||||
return ddraw1_AddRef(&This->IDirectDraw_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI d3d1_AddRef(IDirect3D *iface)
|
||||
|
@ -409,7 +411,7 @@ static ULONG WINAPI d3d1_AddRef(IDirect3D *iface)
|
|||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw1_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
|
||||
return ddraw1_AddRef(&This->IDirectDraw_iface);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -508,13 +510,13 @@ static ULONG WINAPI ddraw2_Release(IDirectDraw2 *iface)
|
|||
|
||||
static ULONG WINAPI ddraw1_Release(IDirectDraw *iface)
|
||||
{
|
||||
IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface);
|
||||
ULONG ref = InterlockedDecrement(&ddraw->ref1);
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref1);
|
||||
|
||||
TRACE("%p decreasing refcount to %u.\n", ddraw, ref);
|
||||
TRACE("%p decreasing refcount to %u.\n", This, ref);
|
||||
|
||||
if (!ref && !InterlockedDecrement(&ddraw->numIfaces))
|
||||
ddraw_destroy(ddraw);
|
||||
if (!ref && !InterlockedDecrement(&This->numIfaces))
|
||||
ddraw_destroy(This);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -534,7 +536,7 @@ static ULONG WINAPI d3d3_Release(IDirect3D3 *iface)
|
|||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw1_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
|
||||
return ddraw1_Release(&This->IDirectDraw_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI d3d2_Release(IDirect3D2 *iface)
|
||||
|
@ -543,7 +545,7 @@ static ULONG WINAPI d3d2_Release(IDirect3D2 *iface)
|
|||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw1_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
|
||||
return ddraw1_Release(&This->IDirectDraw_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI d3d1_Release(IDirect3D *iface)
|
||||
|
@ -552,7 +554,7 @@ static ULONG WINAPI d3d1_Release(IDirect3D *iface)
|
|||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw1_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
|
||||
return ddraw1_Release(&This->IDirectDraw_iface);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -789,9 +791,11 @@ static HRESULT WINAPI ddraw2_SetCooperativeLevel(IDirectDraw2 *iface, HWND windo
|
|||
|
||||
static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window, DWORD flags)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
|
||||
|
||||
return ddraw7_SetCooperativeLevel((IDirectDraw7 *)ddraw_from_ddraw1(iface), window, flags);
|
||||
return ddraw7_SetCooperativeLevel((IDirectDraw7 *)This, window, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -934,9 +938,11 @@ static HRESULT WINAPI ddraw2_SetDisplayMode(IDirectDraw2 *iface,
|
|||
|
||||
static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWORD height, DWORD bpp)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, width %u, height %u, bpp %u.\n", iface, width, height, bpp);
|
||||
|
||||
return ddraw7_SetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw1(iface), width, height, bpp, 0, 0);
|
||||
return ddraw7_SetDisplayMode((IDirectDraw7 *)This, width, height, bpp, 0, 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -992,9 +998,11 @@ static HRESULT WINAPI ddraw2_RestoreDisplayMode(IDirectDraw2 *iface)
|
|||
|
||||
static HRESULT WINAPI ddraw1_RestoreDisplayMode(IDirectDraw *iface)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw7_RestoreDisplayMode((IDirectDraw7 *)ddraw_from_ddraw1(iface));
|
||||
return ddraw7_RestoreDisplayMode((IDirectDraw7 *)This);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1121,9 +1129,11 @@ static HRESULT WINAPI ddraw2_GetCaps(IDirectDraw2 *iface, DDCAPS *driver_caps, D
|
|||
|
||||
static HRESULT WINAPI ddraw1_GetCaps(IDirectDraw *iface, DDCAPS *driver_caps, DDCAPS *hel_caps)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
|
||||
|
||||
return ddraw7_GetCaps((IDirectDraw7 *)ddraw_from_ddraw1(iface), driver_caps, hel_caps);
|
||||
return ddraw7_GetCaps((IDirectDraw7 *)This, driver_caps, hel_caps);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1165,9 +1175,11 @@ static HRESULT WINAPI ddraw2_Compact(IDirectDraw2 *iface)
|
|||
|
||||
static HRESULT WINAPI ddraw1_Compact(IDirectDraw *iface)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw7_Compact((IDirectDraw7 *)ddraw_from_ddraw1(iface));
|
||||
return ddraw7_Compact((IDirectDraw7 *)This);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1260,9 +1272,11 @@ static HRESULT WINAPI ddraw2_GetDisplayMode(IDirectDraw2 *iface, DDSURFACEDESC *
|
|||
|
||||
static HRESULT WINAPI ddraw1_GetDisplayMode(IDirectDraw *iface, DDSURFACEDESC *surface_desc)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
|
||||
|
||||
return ddraw7_GetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw1(iface), (DDSURFACEDESC2 *)surface_desc);
|
||||
return ddraw7_GetDisplayMode((IDirectDraw7 *)This, (DDSURFACEDESC2 *)surface_desc);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1353,9 +1367,11 @@ static HRESULT WINAPI ddraw2_GetFourCCCodes(IDirectDraw2 *iface, DWORD *codes_co
|
|||
|
||||
static HRESULT WINAPI ddraw1_GetFourCCCodes(IDirectDraw *iface, DWORD *codes_count, DWORD *codes)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes);
|
||||
|
||||
return ddraw7_GetFourCCCodes((IDirectDraw7 *)ddraw_from_ddraw1(iface), codes_count, codes);
|
||||
return ddraw7_GetFourCCCodes((IDirectDraw7 *)This, codes_count, codes);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1406,9 +1422,11 @@ static HRESULT WINAPI ddraw2_GetMonitorFrequency(IDirectDraw2 *iface, DWORD *fre
|
|||
|
||||
static HRESULT WINAPI ddraw1_GetMonitorFrequency(IDirectDraw *iface, DWORD *frequency)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, frequency %p.\n", iface, frequency);
|
||||
|
||||
return ddraw7_GetMonitorFrequency((IDirectDraw7 *)ddraw_from_ddraw1(iface), frequency);
|
||||
return ddraw7_GetMonitorFrequency((IDirectDraw7 *)This, frequency);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1468,9 +1486,11 @@ static HRESULT WINAPI ddraw2_GetVerticalBlankStatus(IDirectDraw2 *iface, BOOL *s
|
|||
|
||||
static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *status)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, status %p.\n", iface, status);
|
||||
|
||||
return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)ddraw_from_ddraw1(iface), status);
|
||||
return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)This, status);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1602,9 +1622,11 @@ static HRESULT WINAPI ddraw2_Initialize(IDirectDraw2 *iface, GUID *guid)
|
|||
|
||||
static HRESULT WINAPI ddraw1_Initialize(IDirectDraw *iface, GUID *guid)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
|
||||
|
||||
return ddraw7_Initialize((IDirectDraw7 *)ddraw_from_ddraw1(iface), guid);
|
||||
return ddraw7_Initialize((IDirectDraw7 *)This, guid);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d1_Initialize(IDirect3D *iface, REFIID riid)
|
||||
|
@ -1657,9 +1679,11 @@ static HRESULT WINAPI ddraw2_FlipToGDISurface(IDirectDraw2 *iface)
|
|||
|
||||
static HRESULT WINAPI ddraw1_FlipToGDISurface(IDirectDraw *iface)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return ddraw7_FlipToGDISurface((IDirectDraw7 *)ddraw_from_ddraw1(iface));
|
||||
return ddraw7_FlipToGDISurface((IDirectDraw7 *)This);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1722,9 +1746,11 @@ static HRESULT WINAPI ddraw2_WaitForVerticalBlank(IDirectDraw2 *iface, DWORD fla
|
|||
|
||||
static HRESULT WINAPI ddraw1_WaitForVerticalBlank(IDirectDraw *iface, DWORD flags, HANDLE event)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
|
||||
|
||||
return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags, event);
|
||||
return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)This, flags, event);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1793,9 +1819,11 @@ static HRESULT WINAPI ddraw2_GetScanLine(IDirectDraw2 *iface, DWORD *line)
|
|||
|
||||
static HRESULT WINAPI ddraw1_GetScanLine(IDirectDraw *iface, DWORD *line)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, line %p.\n", iface, line);
|
||||
|
||||
return ddraw7_GetScanLine((IDirectDraw7 *)ddraw_from_ddraw1(iface), line);
|
||||
return ddraw7_GetScanLine((IDirectDraw7 *)This, line);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1919,12 +1947,13 @@ static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurfa
|
|||
|
||||
static HRESULT WINAPI ddraw1_GetGDISurface(IDirectDraw *iface, IDirectDrawSurface **surface)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
IDirectDrawSurface7 *surface7;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, surface %p.\n", iface, surface);
|
||||
|
||||
hr = ddraw7_GetGDISurface((IDirectDraw7 *)ddraw_from_ddraw1(iface), &surface7);
|
||||
hr = ddraw7_GetGDISurface((IDirectDraw7 *)This, &surface7);
|
||||
*surface = surface7 ? (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)surface7)->IDirectDrawSurface3_vtbl : NULL;
|
||||
|
||||
return hr;
|
||||
|
@ -2158,6 +2187,7 @@ static HRESULT WINAPI ddraw2_EnumDisplayModes(IDirectDraw2 *iface, DWORD flags,
|
|||
static HRESULT WINAPI ddraw1_EnumDisplayModes(IDirectDraw *iface, DWORD flags,
|
||||
DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
struct displaymodescallback_context cbcontext;
|
||||
|
||||
TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
|
||||
|
@ -2166,8 +2196,8 @@ static HRESULT WINAPI ddraw1_EnumDisplayModes(IDirectDraw *iface, DWORD flags,
|
|||
cbcontext.func = callback;
|
||||
cbcontext.context = context;
|
||||
|
||||
return ddraw7_EnumDisplayModes((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags,
|
||||
(DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumDisplayModesCallbackThunk);
|
||||
return ddraw7_EnumDisplayModes((IDirectDraw7 *)This, flags, (DDSURFACEDESC2 *)surface_desc,
|
||||
&cbcontext, EnumDisplayModesCallbackThunk);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -3503,7 +3533,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
|
|||
static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
|
||||
DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown)
|
||||
{
|
||||
IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface);
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
IDirectDrawSurface7 *surface7;
|
||||
IDirectDrawSurfaceImpl *impl;
|
||||
HRESULT hr;
|
||||
|
@ -3520,7 +3550,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
|
|||
/* Remove front buffer flag, this causes failure in v7, and its added to normal
|
||||
* primaries anyway. */
|
||||
surface_desc->ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
|
||||
hr = CreateSurface(ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
|
||||
hr = CreateSurface(This, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
*surface = NULL;
|
||||
|
@ -3530,7 +3560,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
|
|||
impl = (IDirectDrawSurfaceImpl *)surface7;
|
||||
*surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_vtbl;
|
||||
ddraw_set_surface_version(impl, 1);
|
||||
IDirectDraw7_Release((IDirectDraw7 *)ddraw);
|
||||
IDirectDraw7_Release((IDirectDraw7 *)This);
|
||||
impl->ifaceToRelease = NULL;
|
||||
|
||||
return hr;
|
||||
|
@ -3773,6 +3803,7 @@ static HRESULT WINAPI ddraw2_EnumSurfaces(IDirectDraw2 *iface, DWORD flags,
|
|||
static HRESULT WINAPI ddraw1_EnumSurfaces(IDirectDraw *iface, DWORD flags,
|
||||
DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
struct surfacescallback_context cbcontext;
|
||||
|
||||
TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
|
||||
|
@ -3781,8 +3812,8 @@ static HRESULT WINAPI ddraw1_EnumSurfaces(IDirectDraw *iface, DWORD flags,
|
|||
cbcontext.func = callback;
|
||||
cbcontext.context = context;
|
||||
|
||||
return ddraw7_EnumSurfaces((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags,
|
||||
(DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumSurfacesCallbackThunk);
|
||||
return ddraw7_EnumSurfaces((IDirectDraw7 *)This, flags, (DDSURFACEDESC2 *)surface_desc,
|
||||
&cbcontext, EnumSurfacesCallbackThunk);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -3892,10 +3923,12 @@ static HRESULT WINAPI ddraw2_CreateClipper(IDirectDraw2 *iface,
|
|||
static HRESULT WINAPI ddraw1_CreateClipper(IDirectDraw *iface,
|
||||
DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
|
||||
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n",
|
||||
iface, flags, clipper, outer_unknown);
|
||||
|
||||
return ddraw7_CreateClipper((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags, clipper, outer_unknown);
|
||||
return ddraw7_CreateClipper((IDirectDraw7 *)This, flags, clipper, outer_unknown);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -4028,17 +4061,17 @@ static HRESULT WINAPI ddraw2_CreatePalette(IDirectDraw2 *iface, DWORD flags,
|
|||
static HRESULT WINAPI ddraw1_CreatePalette(IDirectDraw *iface, DWORD flags,
|
||||
PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown)
|
||||
{
|
||||
IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface);
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n",
|
||||
iface, flags, entries, palette, outer_unknown);
|
||||
|
||||
hr = ddraw7_CreatePalette((IDirectDraw7 *)ddraw, flags, entries, palette, outer_unknown);
|
||||
hr = ddraw7_CreatePalette((IDirectDraw7 *)This, flags, entries, palette, outer_unknown);
|
||||
if (SUCCEEDED(hr) && *palette)
|
||||
{
|
||||
IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette;
|
||||
IDirectDraw7_Release((IDirectDraw7 *)ddraw);
|
||||
IDirectDraw7_Release((IDirectDraw7 *)This);
|
||||
impl->ifaceToRelease = NULL;
|
||||
}
|
||||
|
||||
|
@ -4115,15 +4148,16 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface,
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface,
|
||||
IDirectDrawSurface *src, IDirectDrawSurface **dst)
|
||||
static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSurface *src,
|
||||
IDirectDrawSurface **dst)
|
||||
{
|
||||
IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
|
||||
IDirectDrawSurface7 *src7, *dst7;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
|
||||
src7 = (IDirectDrawSurface7 *)surface_from_surface3((IDirectDrawSurface3 *)src);
|
||||
hr = ddraw7_DuplicateSurface((IDirectDraw7 *)ddraw_from_ddraw1(iface), src7, &dst7);
|
||||
hr = ddraw7_DuplicateSurface((IDirectDraw7 *)This, src7, &dst7);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
*dst = (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)dst7)->IDirectDrawSurface3_vtbl;
|
||||
|
@ -5833,7 +5867,7 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
|
|||
HDC hDC;
|
||||
|
||||
ddraw->lpVtbl = &ddraw7_vtbl;
|
||||
ddraw->IDirectDraw_vtbl = &ddraw1_vtbl;
|
||||
ddraw->IDirectDraw_iface.lpVtbl = &ddraw1_vtbl;
|
||||
ddraw->IDirectDraw2_vtbl = &ddraw2_vtbl;
|
||||
ddraw->IDirectDraw3_vtbl = &ddraw3_vtbl;
|
||||
ddraw->IDirectDraw4_vtbl = &ddraw4_vtbl;
|
||||
|
|
|
@ -100,7 +100,7 @@ struct IDirectDrawImpl
|
|||
const IDirectDraw4Vtbl *IDirectDraw4_vtbl;
|
||||
const IDirectDraw3Vtbl *IDirectDraw3_vtbl;
|
||||
const IDirectDraw2Vtbl *IDirectDraw2_vtbl;
|
||||
const IDirectDrawVtbl *IDirectDraw_vtbl;
|
||||
IDirectDraw IDirectDraw_iface;
|
||||
IDirect3D7 IDirect3D7_iface;
|
||||
IDirect3D3 IDirect3D3_iface;
|
||||
IDirect3D2 IDirect3D2_iface;
|
||||
|
|
|
@ -134,7 +134,7 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface,
|
|||
}
|
||||
else if( IsEqualGUID( &IID_IDirectDraw, refiid ) )
|
||||
{
|
||||
*obj = &This->ddraw->IDirectDraw_vtbl;
|
||||
*obj = &This->ddraw->IDirectDraw_iface;
|
||||
TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -937,7 +937,7 @@ DllMain(HINSTANCE hInstDLL,
|
|||
WARN("DDraw %p has a refcount of %d\n", ddraw, ddraw->ref7 + ddraw->ref4 + ddraw->ref3 + ddraw->ref2 + ddraw->ref1);
|
||||
|
||||
/* Add references to each interface to avoid freeing them unexpectedly */
|
||||
IDirectDraw_AddRef((IDirectDraw *)&ddraw->IDirectDraw_vtbl);
|
||||
IDirectDraw_AddRef(&ddraw->IDirectDraw_iface);
|
||||
IDirectDraw2_AddRef((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl);
|
||||
IDirectDraw3_AddRef((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl);
|
||||
IDirectDraw4_AddRef((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl);
|
||||
|
@ -973,7 +973,7 @@ DllMain(HINSTANCE hInstDLL,
|
|||
/* Release all hanging references to destroy the objects. This
|
||||
* restores the screen mode too
|
||||
*/
|
||||
while(IDirectDraw_Release((IDirectDraw *)&ddraw->IDirectDraw_vtbl));
|
||||
while(IDirectDraw_Release(&ddraw->IDirectDraw_iface));
|
||||
while(IDirectDraw2_Release((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl));
|
||||
while(IDirectDraw3_Release((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl));
|
||||
while(IDirectDraw4_Release((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl));
|
||||
|
|
|
@ -2266,7 +2266,7 @@ static HRESULT WINAPI ddraw_surface7_GetDDInterface(IDirectDrawSurface7 *iface,
|
|||
break;
|
||||
|
||||
case 1:
|
||||
*DD = &This->ddraw->IDirectDraw_vtbl;
|
||||
*DD = &This->ddraw->IDirectDraw_iface;
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue