Commit 4001e60e authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

d3drm: Implement IDirect3DRMFrameX_DeleteChild.

parent 470468c7
...@@ -482,10 +482,16 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteChild(IDirect3DRMFrame2* iface ...@@ -482,10 +482,16 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteChild(IDirect3DRMFrame2* iface
LPDIRECT3DRMFRAME frame) LPDIRECT3DRMFRAME frame)
{ {
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface); 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, static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteLight(IDirect3DRMFrame2* iface,
...@@ -1358,10 +1364,26 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteChild(IDirect3DRMFrame3* iface ...@@ -1358,10 +1364,26 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteChild(IDirect3DRMFrame3* iface
LPDIRECT3DRMFRAME3 frame) LPDIRECT3DRMFRAME3 frame)
{ {
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface); 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, static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteLight(IDirect3DRMFrame3* iface,
......
...@@ -450,7 +450,7 @@ static void test_Frame(void) ...@@ -450,7 +450,7 @@ static void test_Frame(void)
CHECK_REFCOUNT(pFrameP1, 1); CHECK_REFCOUNT(pFrameP1, 1);
hr = IDirect3DRMFrame_DeleteChild(pFrameP1, NULL); 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); CHECK_REFCOUNT(pFrameP1, 1);
/* Add child to first parent */ /* Add child to first parent */
...@@ -547,7 +547,7 @@ static void test_Frame(void) ...@@ -547,7 +547,7 @@ static void test_Frame(void)
/* Delete child */ /* Delete child */
hr = IDirect3DRMFrame_DeleteChild(pFrameP2, pFrameC); 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); todo_wine CHECK_REFCOUNT(pFrameC, 1);
pArray = NULL; pArray = NULL;
......
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