Commit f585faff authored by Aaryaman Vasishta's avatar Aaryaman Vasishta Committed by Alexandre Julliard

d3drm: Fix viewport object creation.

parent e6feb9b0
......@@ -400,10 +400,12 @@ static HRESULT WINAPI d3drm1_CreateShadow(IDirect3DRM *iface, IDirect3DRMVisual
static HRESULT WINAPI d3drm1_CreateViewport(IDirect3DRM *iface, IDirect3DRMDevice *device,
IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
{
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
iface, device, camera, x, y, width, height, viewport);
return Direct3DRMViewport_create(&IID_IDirect3DRMViewport, (IUnknown **)viewport);
return IDirect3DRM2_CreateViewport(&d3drm->IDirect3DRM2_iface, device, camera, x, y, width, height, viewport);
}
static HRESULT WINAPI d3drm1_CreateWrap(IDirect3DRM *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
......@@ -861,10 +863,19 @@ static HRESULT WINAPI d3drm2_CreateShadow(IDirect3DRM2 *iface, IDirect3DRMVisual
static HRESULT WINAPI d3drm2_CreateViewport(IDirect3DRM2 *iface, IDirect3DRMDevice *device,
IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
{
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
struct d3drm_viewport *object;
HRESULT hr;
FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
iface, device, camera, x, y, width, height, viewport);
return Direct3DRMViewport_create(&IID_IDirect3DRMViewport, (IUnknown **)viewport);
if (FAILED(hr = d3drm_viewport_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*viewport = &object->IDirect3DRMViewport_iface;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm2_CreateWrap(IDirect3DRM2 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
......@@ -1423,10 +1434,19 @@ static HRESULT WINAPI d3drm3_CreateTextureFromSurface(IDirect3DRM3 *iface,
static HRESULT WINAPI d3drm3_CreateViewport(IDirect3DRM3 *iface, IDirect3DRMDevice3 *device,
IDirect3DRMFrame3 *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport2 **viewport)
{
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
struct d3drm_viewport *object;
HRESULT hr;
FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
iface, device, camera, x, y, width, height, viewport);
return Direct3DRMViewport_create(&IID_IDirect3DRMViewport2, (IUnknown **)viewport);
if (FAILED(hr = d3drm_viewport_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*viewport = &object->IDirect3DRMViewport2_iface;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm3_CreateWrap(IDirect3DRM3 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame3 *frame,
......
......@@ -65,6 +65,18 @@ struct d3drm_frame
D3DCOLOR scenebackground;
};
struct d3drm_viewport
{
struct d3drm_object obj;
IDirect3DRMViewport IDirect3DRMViewport_iface;
IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
IDirect3DRM *d3drm;
D3DVALUE back;
D3DVALUE front;
D3DVALUE field;
D3DRMPROJECTIONTYPE projection;
};
void d3drm_object_init(struct d3drm_object *object) DECLSPEC_HIDDEN;
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
......@@ -73,6 +85,7 @@ void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
HRESULT d3drm_device_create(struct d3drm_device **out) DECLSPEC_HIDDEN;
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
IDirect3DRMDevice *IDirect3DRMDevice_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN;
IDirect3DRMDevice2 *IDirect3DRMDevice2_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN;
IDirect3DRMDevice3 *IDirect3DRMDevice3_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN;
......@@ -80,7 +93,6 @@ HRESULT Direct3DRMFace_create(REFIID riid, IUnknown** ret_iface) DECLSPEC_HIDDEN
HRESULT Direct3DRMLight_create(IUnknown** ppObj) DECLSPEC_HIDDEN;
HRESULT Direct3DRMMesh_create(IDirect3DRMMesh** obj) DECLSPEC_HIDDEN;
HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown** ppObj) DECLSPEC_HIDDEN;
HRESULT Direct3DRMViewport_create(REFIID riid, IUnknown** ppObj) DECLSPEC_HIDDEN;
HRESULT Direct3DRMMaterial_create(IDirect3DRMMaterial2** ret_iface) DECLSPEC_HIDDEN;
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
......
......@@ -29,17 +29,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
struct d3drm_viewport
{
struct d3drm_object obj;
IDirect3DRMViewport IDirect3DRMViewport_iface;
IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
D3DVALUE back;
D3DVALUE front;
D3DVALUE field;
D3DRMPROJECTIONTYPE projection;
};
static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport(IDirect3DRMViewport *iface)
{
return CONTAINING_RECORD(iface, struct d3drm_viewport, IDirect3DRMViewport_iface);
......@@ -829,23 +818,21 @@ static const struct IDirect3DRMViewport2Vtbl d3drm_viewport2_vtbl =
d3drm_viewport2_InverseTransformVectors,
};
HRESULT Direct3DRMViewport_create(REFIID riid, IUnknown **out)
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm)
{
struct d3drm_viewport *object;
TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl;
object->d3drm = d3drm;
d3drm_object_init(&object->obj);
if (IsEqualGUID(riid, &IID_IDirect3DRMViewport2))
*out = (IUnknown *)&object->IDirect3DRMViewport2_iface;
else
*out = (IUnknown *)&object->IDirect3DRMViewport_iface;
*viewport = object;
return S_OK;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment