d3drm: Implement IDirect3DRMFrameX_DeleteChild.

This commit is contained in:
Christian Costa 2012-04-13 13:55:23 +02:00 committed by Alexandre Julliard
parent 470468c72e
commit 4001e60e34
2 changed files with 28 additions and 6 deletions

View File

@ -482,10 +482,16 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteChild(IDirect3DRMFrame2* iface
LPDIRECT3DRMFRAME frame)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameImpl *child;
FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
TRACE("(%p/%p)->(%p)\n", iface, This, frame);
return E_NOTIMPL;
child = unsafe_impl_from_IDirect3DRMFrame2((LPDIRECT3DRMFRAME2)frame);
if (!child)
return D3DRMERR_BADOBJECT;
return IDirect3DRMFrame3_DeleteChild(&This->IDirect3DRMFrame3_iface, &child->IDirect3DRMFrame3_iface);
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteLight(IDirect3DRMFrame2* iface,
@ -1358,10 +1364,26 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteChild(IDirect3DRMFrame3* iface
LPDIRECT3DRMFRAME3 frame)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
ULONG i;
FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
TRACE("(%p/%p)->(%p)\n", iface, This, frame);
return E_NOTIMPL;
if (!frame)
return D3DRMERR_BADOBJECT;
/* Check if child exists */
for (i = 0; i < This->nb_children; i++)
if (This->children[i] == frame)
break;
if (i == This->nb_children)
return D3DRMERR_BADVALUE;
memmove(This->children + i, This->children + i + 1, sizeof(IDirect3DRMFrame3*) * (This->nb_children - 1 - i));
IDirect3DRMFrame3_Release(frame);
This->nb_children--;
return D3DRM_OK;
}
static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteLight(IDirect3DRMFrame3* iface,

View File

@ -450,7 +450,7 @@ static void test_Frame(void)
CHECK_REFCOUNT(pFrameP1, 1);
hr = IDirect3DRMFrame_DeleteChild(pFrameP1, NULL);
todo_wine ok(hr == D3DRMERR_BADOBJECT, "Should have returned D3DRMERR_BADOBJECT (hr = %x)\n", hr);
ok(hr == D3DRMERR_BADOBJECT, "Should have returned D3DRMERR_BADOBJECT (hr = %x)\n", hr);
CHECK_REFCOUNT(pFrameP1, 1);
/* Add child to first parent */
@ -547,7 +547,7 @@ static void test_Frame(void)
/* Delete child */
hr = IDirect3DRMFrame_DeleteChild(pFrameP2, pFrameC);
todo_wine ok(hr == D3DRM_OK, "Cannot delete child frame (hr = %x)\n", hr);
ok(hr == D3DRM_OK, "Cannot delete child frame (hr = %x)\n", hr);
todo_wine CHECK_REFCOUNT(pFrameC, 1);
pArray = NULL;