d3drm: Avoid LPDIRECT3DRMFRAMEARRAY.

This commit is contained in:
Henri Verbeet 2013-06-05 11:06:14 +02:00 committed by Alexandre Julliard
parent 31f9cae2bd
commit 8c882f6819
3 changed files with 53 additions and 55 deletions

View File

@ -685,14 +685,13 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_AddVisual(IDirect3DRMFrame2 *iface,
return IDirect3DRMFrame3_AddVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual);
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetChildren(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAMEARRAY *children)
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetChildren(IDirect3DRMFrame2 *iface, IDirect3DRMFrameArray **children)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameImpl *frame = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, children);
TRACE("iface %p, children %p.\n", iface, children);
return IDirect3DRMFrame3_GetChildren(&This->IDirect3DRMFrame3_iface, children);
return IDirect3DRMFrame3_GetChildren(&frame->IDirect3DRMFrame3_iface, children);
}
static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetColor(IDirect3DRMFrame2* iface)
@ -1683,8 +1682,7 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_AddVisual(IDirect3DRMFrame3* iface,
return D3DRM_OK;
}
static HRESULT WINAPI IDirect3DRMFrame3Impl_GetChildren(IDirect3DRMFrame3* iface,
LPDIRECT3DRMFRAMEARRAY *children)
static HRESULT WINAPI IDirect3DRMFrame3Impl_GetChildren(IDirect3DRMFrame3 *iface, IDirect3DRMFrameArray **children)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
IDirect3DRMFrameArrayImpl* obj;

View File

@ -911,7 +911,7 @@ static void test_Frame(void)
IDirect3DRMFrame *pFrameP1;
IDirect3DRMFrame *pFrameP2;
IDirect3DRMFrame *pFrameTmp;
LPDIRECT3DRMFRAMEARRAY pArray;
IDirect3DRMFrameArray *frame_array;
IDirect3DRMMeshBuilder *mesh_builder;
IDirect3DRMVisual *visual1;
IDirect3DRMVisual *visual_tmp;
@ -951,18 +951,18 @@ static void test_Frame(void)
ok(pFrameTmp == NULL, "pFrameTmp = %p\n", pFrameTmp);
CHECK_REFCOUNT(pFrameC, 1);
pArray = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameC, &pArray);
frame_array = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameC, &frame_array);
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);
ok(pArray != NULL, "pArray = %p\n", pArray);
if (pArray)
ok(!!frame_array, "frame_array = %p\n", frame_array);
if (frame_array)
{
count = IDirect3DRMFrameArray_GetSize(pArray);
count = IDirect3DRMFrameArray_GetSize(frame_array);
ok(count == 0, "count = %u\n", count);
hr = IDirect3DRMFrameArray_GetElement(pArray, 0, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 0, &pFrameTmp);
ok(hr == D3DRMERR_BADVALUE, "Should have returned D3DRMERR_BADVALUE (hr = %x)\n", hr);
ok(pFrameTmp == NULL, "pFrameTmp = %p\n", pFrameTmp);
IDirect3DRMFrameArray_Release(pArray);
IDirect3DRMFrameArray_Release(frame_array);
}
hr = IDirect3DRM_CreateFrame(d3drm, NULL, &pFrameP1);
@ -993,17 +993,17 @@ static void test_Frame(void)
CHECK_REFCOUNT(pFrameP1, 1);
CHECK_REFCOUNT(pFrameC, 2);
pArray = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP1, &pArray);
frame_array = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP1, &frame_array);
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);
/* In some older version of d3drm, creating IDirect3DRMFrameArray object with GetChildren does not increment refcount of children frames */
ok((get_refcount((IUnknown*)pFrameC) == 3) || broken(get_refcount((IUnknown*)pFrameC) == 2),
"Invalid refcount. Expected 3 (or 2) got %d\n", get_refcount((IUnknown*)pFrameC));
if (pArray)
if (frame_array)
{
count = IDirect3DRMFrameArray_GetSize(pArray);
count = IDirect3DRMFrameArray_GetSize(frame_array);
ok(count == 1, "count = %u\n", count);
hr = IDirect3DRMFrameArray_GetElement(pArray, 0, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 0, &pFrameTmp);
ok(hr == D3DRM_OK, "Cannot get element (hr = %x)\n", hr);
ok(pFrameTmp == pFrameC, "pFrameTmp = %p\n", pFrameTmp);
ok((get_refcount((IUnknown*)pFrameC) == 4) || broken(get_refcount((IUnknown*)pFrameC) == 3),
@ -1011,7 +1011,7 @@ static void test_Frame(void)
IDirect3DRMFrame_Release(pFrameTmp);
ok((get_refcount((IUnknown*)pFrameC) == 3) || broken(get_refcount((IUnknown*)pFrameC) == 2),
"Invalid refcount. Expected 3 (or 2) got %d\n", get_refcount((IUnknown*)pFrameC));
IDirect3DRMFrameArray_Release(pArray);
IDirect3DRMFrameArray_Release(frame_array);
CHECK_REFCOUNT(pFrameC, 2);
}
@ -1029,32 +1029,32 @@ static void test_Frame(void)
ok(hr == D3DRM_OK, "Cannot add child frame (hr = %x)\n", hr);
CHECK_REFCOUNT(pFrameC, 2);
pArray = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &pArray);
frame_array = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &frame_array);
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);
if (pArray)
if (frame_array)
{
count = IDirect3DRMFrameArray_GetSize(pArray);
count = IDirect3DRMFrameArray_GetSize(frame_array);
ok(count == 1, "count = %u\n", count);
hr = IDirect3DRMFrameArray_GetElement(pArray, 0, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 0, &pFrameTmp);
ok(hr == D3DRM_OK, "Cannot get element (hr = %x)\n", hr);
ok(pFrameTmp == pFrameC, "pFrameTmp = %p\n", pFrameTmp);
IDirect3DRMFrame_Release(pFrameTmp);
IDirect3DRMFrameArray_Release(pArray);
IDirect3DRMFrameArray_Release(frame_array);
}
pArray = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP1, &pArray);
frame_array = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP1, &frame_array);
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);
if (pArray)
if (frame_array)
{
count = IDirect3DRMFrameArray_GetSize(pArray);
count = IDirect3DRMFrameArray_GetSize(frame_array);
ok(count == 0, "count = %u\n", count);
pFrameTmp = (void*)0xdeadbeef;
hr = IDirect3DRMFrameArray_GetElement(pArray, 0, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 0, &pFrameTmp);
ok(hr == D3DRMERR_BADVALUE, "Should have returned D3DRMERR_BADVALUE (hr = %x)\n", hr);
ok(pFrameTmp == NULL, "pFrameTmp = %p\n", pFrameTmp);
IDirect3DRMFrameArray_Release(pArray);
IDirect3DRMFrameArray_Release(frame_array);
}
pFrameTmp = (void*)0xdeadbeef;
@ -1069,18 +1069,18 @@ static void test_Frame(void)
ok(hr == D3DRM_OK, "Cannot add child frame (hr = %x)\n", hr);
CHECK_REFCOUNT(pFrameC, 2);
pArray = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &pArray);
frame_array = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &frame_array);
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);
if (pArray)
if (frame_array)
{
count = IDirect3DRMFrameArray_GetSize(pArray);
count = IDirect3DRMFrameArray_GetSize(frame_array);
ok(count == 1, "count = %u\n", count);
hr = IDirect3DRMFrameArray_GetElement(pArray, 0, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 0, &pFrameTmp);
ok(hr == D3DRM_OK, "Cannot get element (hr = %x)\n", hr);
ok(pFrameTmp == pFrameC, "pFrameTmp = %p\n", pFrameTmp);
IDirect3DRMFrame_Release(pFrameTmp);
IDirect3DRMFrameArray_Release(pArray);
IDirect3DRMFrameArray_Release(frame_array);
}
/* Delete child */
@ -1088,18 +1088,18 @@ static void test_Frame(void)
ok(hr == D3DRM_OK, "Cannot delete child frame (hr = %x)\n", hr);
CHECK_REFCOUNT(pFrameC, 1);
pArray = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &pArray);
frame_array = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &frame_array);
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);
if (pArray)
if (frame_array)
{
count = IDirect3DRMFrameArray_GetSize(pArray);
count = IDirect3DRMFrameArray_GetSize(frame_array);
ok(count == 0, "count = %u\n", count);
pFrameTmp = (void*)0xdeadbeef;
hr = IDirect3DRMFrameArray_GetElement(pArray, 0, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 0, &pFrameTmp);
ok(hr == D3DRMERR_BADVALUE, "Should have returned D3DRMERR_BADVALUE (hr = %x)\n", hr);
ok(pFrameTmp == NULL, "pFrameTmp = %p\n", pFrameTmp);
IDirect3DRMFrameArray_Release(pArray);
IDirect3DRMFrameArray_Release(frame_array);
}
pFrameTmp = (void*)0xdeadbeef;
@ -1116,22 +1116,22 @@ static void test_Frame(void)
ok(hr == D3DRM_OK, "Cannot add child frame (hr = %x)\n", hr);
CHECK_REFCOUNT(pFrameP1, 3);
pArray = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &pArray);
frame_array = NULL;
hr = IDirect3DRMFrame_GetChildren(pFrameP2, &frame_array);
ok(hr == D3DRM_OK, "Cannot get children (hr = %x)\n", hr);
if (pArray)
if (frame_array)
{
count = IDirect3DRMFrameArray_GetSize(pArray);
count = IDirect3DRMFrameArray_GetSize(frame_array);
ok(count == 2, "count = %u\n", count);
hr = IDirect3DRMFrameArray_GetElement(pArray, 0, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 0, &pFrameTmp);
ok(hr == D3DRM_OK, "Cannot get element (hr = %x)\n", hr);
ok(pFrameTmp == pFrameC, "pFrameTmp = %p\n", pFrameTmp);
IDirect3DRMFrame_Release(pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(pArray, 1, &pFrameTmp);
hr = IDirect3DRMFrameArray_GetElement(frame_array, 1, &pFrameTmp);
ok(hr == D3DRM_OK, "Cannot get element (hr = %x)\n", hr);
ok(pFrameTmp == pFrameP1, "pFrameTmp = %p\n", pFrameTmp);
IDirect3DRMFrame_Release(pFrameTmp);
IDirect3DRMFrameArray_Release(pArray);
IDirect3DRMFrameArray_Release(frame_array);
}
/* [Add/Delete]Visual with NULL pointer */

View File

@ -1104,7 +1104,7 @@ DECLARE_INTERFACE_(IDirect3DRMFrame,IDirect3DRMVisual)
STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE;
STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE;
STDMETHOD(AddVisual)(THIS_ IDirect3DRMVisual *visual) PURE;
STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE;
STDMETHOD(GetChildren)(THIS_ struct IDirect3DRMFrameArray **children) PURE;
STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE;
STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE;
STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE;
@ -1337,7 +1337,7 @@ DECLARE_INTERFACE_(IDirect3DRMFrame2,IDirect3DRMFrame)
STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE;
STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE;
STDMETHOD(AddVisual)(THIS_ IDirect3DRMVisual *visual) PURE;
STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE;
STDMETHOD(GetChildren)(THIS_ struct IDirect3DRMFrameArray **children) PURE;
STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE;
STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE;
STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE;
@ -1619,7 +1619,7 @@ DECLARE_INTERFACE_(IDirect3DRMFrame3,IDirect3DRMVisual)
STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE;
STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE;
STDMETHOD(AddVisual)(THIS_ LPUNKNOWN) PURE;
STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE;
STDMETHOD(GetChildren)(THIS_ struct IDirect3DRMFrameArray **children) PURE;
STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE;
STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE;
STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE;