d3drm: Implement IDirect3DRMDevice*::Add/DeleteDestroyCallback.

Signed-off-by: Aaryaman Vasishta <jem456.vasishta@gmail.com>
Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aaryaman Vasishta 2016-07-10 22:11:11 +05:30 committed by Alexandre Julliard
parent 474b6e3e0e
commit ce64ef51e2
2 changed files with 29 additions and 16 deletions

View File

@ -83,6 +83,7 @@ struct d3drm_viewport
struct d3drm_device struct d3drm_device
{ {
struct d3drm_object obj;
IDirect3DRMDevice IDirect3DRMDevice_iface; IDirect3DRMDevice IDirect3DRMDevice_iface;
IDirect3DRMDevice2 IDirect3DRMDevice2_iface; IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
IDirect3DRMDevice3 IDirect3DRMDevice3_iface; IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
@ -92,7 +93,6 @@ struct d3drm_device
IDirectDrawSurface *primary_surface, *render_target; IDirectDrawSurface *primary_surface, *render_target;
IDirectDrawClipper *clipper; IDirectDrawClipper *clipper;
IDirect3DDevice *device; IDirect3DDevice *device;
LONG ref;
BOOL dither; BOOL dither;
D3DRMRENDERQUALITY quality; D3DRMRENDERQUALITY quality;
DWORD rendermode; DWORD rendermode;

View File

@ -47,6 +47,7 @@ static inline struct d3drm_device *impl_from_IDirect3DRMDevice3(IDirect3DRMDevic
void d3drm_device_destroy(struct d3drm_device *device) void d3drm_device_destroy(struct d3drm_device *device)
{ {
d3drm_object_cleanup((IDirect3DRMObject *)&device->IDirect3DRMDevice_iface, &device->obj);
if (device->device) if (device->device)
{ {
TRACE("Releasing attached ddraw interfaces.\n"); TRACE("Releasing attached ddraw interfaces.\n");
@ -299,7 +300,7 @@ static HRESULT WINAPI d3drm_device1_QueryInterface(IDirect3DRMDevice *iface, REF
static ULONG WINAPI d3drm_device3_AddRef(IDirect3DRMDevice3 *iface) static ULONG WINAPI d3drm_device3_AddRef(IDirect3DRMDevice3 *iface)
{ {
struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
ULONG refcount = InterlockedIncrement(&device->ref); ULONG refcount = InterlockedIncrement(&device->obj.ref);
TRACE("%p increasing refcount to %u.\n", iface, refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount);
@ -327,7 +328,7 @@ static ULONG WINAPI d3drm_device1_AddRef(IDirect3DRMDevice *iface)
static ULONG WINAPI d3drm_device3_Release(IDirect3DRMDevice3 *iface) static ULONG WINAPI d3drm_device3_Release(IDirect3DRMDevice3 *iface)
{ {
struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
ULONG refcount = InterlockedDecrement(&device->ref); ULONG refcount = InterlockedDecrement(&device->obj.ref);
TRACE("%p decreasing refcount to %u.\n", iface, refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount);
@ -386,49 +387,61 @@ static HRESULT WINAPI d3drm_device1_Clone(IDirect3DRMDevice *iface,
static HRESULT WINAPI d3drm_device3_AddDestroyCallback(IDirect3DRMDevice3 *iface, static HRESULT WINAPI d3drm_device3_AddDestroyCallback(IDirect3DRMDevice3 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx) D3DRMOBJECTCALLBACK cb, void *ctx)
{ {
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
return E_NOTIMPL; TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_add_destroy_callback(&device->obj, cb, ctx);
} }
static HRESULT WINAPI d3drm_device2_AddDestroyCallback(IDirect3DRMDevice2 *iface, static HRESULT WINAPI d3drm_device2_AddDestroyCallback(IDirect3DRMDevice2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx) D3DRMOBJECTCALLBACK cb, void *ctx)
{ {
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
return E_NOTIMPL; TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_device3_AddDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx);
} }
static HRESULT WINAPI d3drm_device1_AddDestroyCallback(IDirect3DRMDevice *iface, static HRESULT WINAPI d3drm_device1_AddDestroyCallback(IDirect3DRMDevice *iface,
D3DRMOBJECTCALLBACK cb, void *ctx) D3DRMOBJECTCALLBACK cb, void *ctx)
{ {
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface);
return E_NOTIMPL; TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_device3_AddDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx);
} }
static HRESULT WINAPI d3drm_device3_DeleteDestroyCallback(IDirect3DRMDevice3 *iface, static HRESULT WINAPI d3drm_device3_DeleteDestroyCallback(IDirect3DRMDevice3 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx) D3DRMOBJECTCALLBACK cb, void *ctx)
{ {
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
return E_NOTIMPL; TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_delete_destroy_callback(&device->obj, cb, ctx);
} }
static HRESULT WINAPI d3drm_device2_DeleteDestroyCallback(IDirect3DRMDevice2 *iface, static HRESULT WINAPI d3drm_device2_DeleteDestroyCallback(IDirect3DRMDevice2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx) D3DRMOBJECTCALLBACK cb, void *ctx)
{ {
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
return E_NOTIMPL; TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_device3_DeleteDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx);
} }
static HRESULT WINAPI d3drm_device1_DeleteDestroyCallback(IDirect3DRMDevice *iface, static HRESULT WINAPI d3drm_device1_DeleteDestroyCallback(IDirect3DRMDevice *iface,
D3DRMOBJECTCALLBACK cb, void *ctx) D3DRMOBJECTCALLBACK cb, void *ctx)
{ {
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface);
return E_NOTIMPL; TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_device3_DeleteDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx);
} }
static HRESULT WINAPI d3drm_device3_SetAppData(IDirect3DRMDevice3 *iface, DWORD data) static HRESULT WINAPI d3drm_device3_SetAppData(IDirect3DRMDevice3 *iface, DWORD data)
@ -1582,7 +1595,7 @@ HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl; object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl;
object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl; object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl;
object->d3drm = d3drm; object->d3drm = d3drm;
object->ref = 1; d3drm_object_init(&object->obj);
*device = object; *device = object;