d3drm: Implement SetAppData/GetAppData for a viewport.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-01 19:45:29 +03:00 committed by Alexandre Julliard
parent 8cbb680b44
commit 7cf81baca4
3 changed files with 48 additions and 13 deletions

View File

@ -25,6 +25,11 @@
#include "dxfile.h" #include "dxfile.h"
struct d3drm_device; struct d3drm_device;
struct d3drm_object
{
LONG ref;
DWORD appdata;
};
HRESULT d3drm_device_create(struct d3drm_device **out) DECLSPEC_HIDDEN; HRESULT d3drm_device_create(struct d3drm_device **out) DECLSPEC_HIDDEN;
IDirect3DRMDevice *IDirect3DRMDevice_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN; IDirect3DRMDevice *IDirect3DRMDevice_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN;

View File

@ -1220,10 +1220,11 @@ static void test_Viewport(void)
IDirect3DRMDevice *device; IDirect3DRMDevice *device;
IDirect3DRMFrame *frame; IDirect3DRMFrame *frame;
IDirect3DRMViewport *viewport; IDirect3DRMViewport *viewport;
IDirect3DRMViewport2 *viewport2;
GUID driver; GUID driver;
HWND window; HWND window;
RECT rc; RECT rc;
DWORD size; DWORD size, data;
CHAR cname[64] = {0}; CHAR cname[64] = {0};
window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0); window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0);
@ -1261,6 +1262,26 @@ static void test_Viewport(void)
ok(size == sizeof("Viewport"), "wrong size: %u\n", size); ok(size == sizeof("Viewport"), "wrong size: %u\n", size);
ok(!strcmp(cname, "Viewport"), "Expected cname to be \"Viewport\", but got \"%s\"\n", cname); ok(!strcmp(cname, "Viewport"), "Expected cname to be \"Viewport\", but got \"%s\"\n", cname);
/* AppData */
hr = IDirect3DRMViewport_SetAppData(viewport, 0);
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
hr = IDirect3DRMViewport_SetAppData(viewport, 0);
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
hr = IDirect3DRMViewport_SetAppData(viewport, 1);
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
hr = IDirect3DRMViewport_SetAppData(viewport, 1);
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
hr = IDirect3DRMViewport_QueryInterface(viewport, &IID_IDirect3DRMViewport2, (void**)&viewport2);
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
data = IDirect3DRMViewport2_GetAppData(viewport2);
ok(data == 1, "got %x\n", data);
IDirect3DRMViewport2_Release(viewport2);
IDirect3DRMViewport_Release(viewport); IDirect3DRMViewport_Release(viewport);
IDirect3DRMFrame_Release(frame); IDirect3DRMFrame_Release(frame);
IDirect3DRMDevice_Release(device); IDirect3DRMDevice_Release(device);

View File

@ -31,9 +31,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
struct d3drm_viewport struct d3drm_viewport
{ {
struct d3drm_object obj;
IDirect3DRMViewport IDirect3DRMViewport_iface; IDirect3DRMViewport IDirect3DRMViewport_iface;
IDirect3DRMViewport2 IDirect3DRMViewport2_iface; IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
LONG ref;
D3DVALUE back; D3DVALUE back;
D3DVALUE front; D3DVALUE front;
D3DVALUE field; D3DVALUE field;
@ -79,7 +79,7 @@ static HRESULT WINAPI d3drm_viewport1_QueryInterface(IDirect3DRMViewport *iface,
static ULONG WINAPI d3drm_viewport1_AddRef(IDirect3DRMViewport *iface) static ULONG WINAPI d3drm_viewport1_AddRef(IDirect3DRMViewport *iface)
{ {
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
ULONG refcount = InterlockedIncrement(&viewport->ref); ULONG refcount = InterlockedIncrement(&viewport->obj.ref);
TRACE("%p increasing refcount to %u.\n", iface, refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount);
@ -89,7 +89,7 @@ static ULONG WINAPI d3drm_viewport1_AddRef(IDirect3DRMViewport *iface)
static ULONG WINAPI d3drm_viewport1_Release(IDirect3DRMViewport *iface) static ULONG WINAPI d3drm_viewport1_Release(IDirect3DRMViewport *iface)
{ {
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
ULONG refcount = InterlockedDecrement(&viewport->ref); ULONG refcount = InterlockedDecrement(&viewport->obj.ref);
TRACE("%p decreasing refcount to %u.\n", iface, refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount);
@ -125,16 +125,20 @@ static HRESULT WINAPI d3drm_viewport1_DeleteDestroyCallback(IDirect3DRMViewport
static HRESULT WINAPI d3drm_viewport1_SetAppData(IDirect3DRMViewport *iface, DWORD data) static HRESULT WINAPI d3drm_viewport1_SetAppData(IDirect3DRMViewport *iface, DWORD data)
{ {
FIXME("iface %p, data %#x stub!\n", iface, data); struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
return E_NOTIMPL; TRACE("iface %p, data %#x\n", iface, data);
return IDirect3DRMViewport2_SetAppData(&viewport->IDirect3DRMViewport2_iface, data);
} }
static DWORD WINAPI d3drm_viewport1_GetAppData(IDirect3DRMViewport *iface) static DWORD WINAPI d3drm_viewport1_GetAppData(IDirect3DRMViewport *iface)
{ {
FIXME("iface %p.\n", iface); struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
return 0; TRACE("iface %p.\n", iface);
return IDirect3DRMViewport2_GetAppData(&viewport->IDirect3DRMViewport2_iface);
} }
static HRESULT WINAPI d3drm_viewport1_SetName(IDirect3DRMViewport *iface, const char *name) static HRESULT WINAPI d3drm_viewport1_SetName(IDirect3DRMViewport *iface, const char *name)
@ -478,16 +482,21 @@ static HRESULT WINAPI d3drm_viewport2_DeleteDestroyCallback(IDirect3DRMViewport2
static HRESULT WINAPI d3drm_viewport2_SetAppData(IDirect3DRMViewport2 *iface, DWORD data) static HRESULT WINAPI d3drm_viewport2_SetAppData(IDirect3DRMViewport2 *iface, DWORD data)
{ {
FIXME("iface %p, data %#x stub!\n", iface, data); struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
return E_NOTIMPL; TRACE("iface %p, data %#x\n", iface, data);
viewport->obj.appdata = data;
return S_OK;
} }
static DWORD WINAPI d3drm_viewport2_GetAppData(IDirect3DRMViewport2 *iface) static DWORD WINAPI d3drm_viewport2_GetAppData(IDirect3DRMViewport2 *iface)
{ {
FIXME("iface %p stub!\n", iface); struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
return 0; TRACE("iface %p\n", iface);
return viewport->obj.appdata;
} }
static HRESULT WINAPI d3drm_viewport2_SetName(IDirect3DRMViewport2 *iface, const char *name) static HRESULT WINAPI d3drm_viewport2_SetName(IDirect3DRMViewport2 *iface, const char *name)
@ -819,7 +828,7 @@ HRESULT Direct3DRMViewport_create(REFIID riid, IUnknown **out)
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl; object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl; object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl;
object->ref = 1; object->obj.ref = 1;
if (IsEqualGUID(riid, &IID_IDirect3DRMViewport2)) if (IsEqualGUID(riid, &IID_IDirect3DRMViewport2))
*out = (IUnknown *)&object->IDirect3DRMViewport2_iface; *out = (IUnknown *)&object->IDirect3DRMViewport2_iface;