d3drm: Store animated frame pointer in animation object.

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 2017-06-27 11:17:11 +03:00 committed by Alexandre Julliard
parent a731eaa705
commit 9b35d5c6d4
3 changed files with 70 additions and 6 deletions

View File

@ -213,6 +213,7 @@ struct d3drm_animation
IDirect3DRMAnimation IDirect3DRMAnimation_iface;
LONG ref;
IDirect3DRM *d3drm;
IDirect3DRMFrame3 *frame;
};
struct d3drm_wrap

View File

@ -3277,9 +3277,21 @@ static HRESULT WINAPI d3drm_animation1_DeleteKey(IDirect3DRMAnimation *iface, D3
static HRESULT WINAPI d3drm_animation1_SetFrame(IDirect3DRMAnimation *iface, IDirect3DRMFrame *frame)
{
FIXME("iface %p, frame %p.\n", iface, frame);
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
HRESULT hr = D3DRM_OK;
return E_NOTIMPL;
TRACE("iface %p, frame %p.\n", iface, frame);
if (frame)
{
hr = IDirect3DRMFrame_QueryInterface(frame, &IID_IDirect3DRMFrame3, (void **)&animation->frame);
if (SUCCEEDED(hr))
IDirect3DRMFrame3_Release(animation->frame);
}
else
animation->frame = NULL;
return hr;
}
static HRESULT WINAPI d3drm_animation1_SetTime(IDirect3DRMAnimation *iface, D3DVALUE time)
@ -3335,9 +3347,13 @@ static HRESULT WINAPI d3drm_animation2_DeleteKey(IDirect3DRMAnimation2 *iface, D
static HRESULT WINAPI d3drm_animation2_SetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 *frame)
{
FIXME("iface %p, frame %p.\n", iface, frame);
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
return E_NOTIMPL;
TRACE("iface %p, frame %p.\n", iface, frame);
animation->frame = frame;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_animation2_SetTime(IDirect3DRMAnimation2 *iface, D3DVALUE time)
@ -3356,9 +3372,18 @@ static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation2_GetOptions(IDirect3DRMAnima
static HRESULT WINAPI d3drm_animation2_GetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 **frame)
{
FIXME("iface %p, frame %p.\n", iface, frame);
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
return E_NOTIMPL;
TRACE("iface %p, frame %p.\n", iface, frame);
if (!frame)
return D3DRMERR_BADVALUE;
*frame = animation->frame;
if (*frame)
IDirect3DRMFrame3_AddRef(*frame);
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_animation2_DeleteKeyByID(IDirect3DRMAnimation2 *iface, DWORD id)

View File

@ -6707,6 +6707,8 @@ static void test_animation(void)
IDirect3DRMAnimation2 *animation2;
IDirect3DRMAnimation *animation;
IDirect3DRMObject *obj, *obj2;
IDirect3DRMFrame3 *frame3;
IDirect3DRMFrame *frame;
IDirect3DRM *d3drm1;
HRESULT hr;
@ -6738,6 +6740,42 @@ static void test_animation(void)
IDirect3DRMObject_Release(obj);
IDirect3DRMObject_Release(obj2);
/* Set animated frame, get it back. */
hr = IDirect3DRM_CreateFrame(d3drm1, NULL, &frame);
ok(SUCCEEDED(hr), "Failed to create a frame, hr %#x.\n", hr);
hr = IDirect3DRMAnimation_SetFrame(animation, NULL);
ok(SUCCEEDED(hr), "Failed to reset frame, hr %#x.\n", hr);
CHECK_REFCOUNT(frame, 1);
hr = IDirect3DRMAnimation_SetFrame(animation, frame);
ok(SUCCEEDED(hr), "Failed to set a frame, hr %#x.\n", hr);
CHECK_REFCOUNT(frame, 1);
hr = IDirect3DRMAnimation2_GetFrame(animation2, NULL);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
hr = IDirect3DRMAnimation2_GetFrame(animation2, &frame3);
ok(SUCCEEDED(hr), "Failed to get the frame, %#x.\n", hr);
ok(frame3 != (void *)frame, "Unexpected interface pointer.\n");
CHECK_REFCOUNT(frame, 2);
IDirect3DRMFrame3_Release(frame3);
hr = IDirect3DRMAnimation_SetFrame(animation, NULL);
ok(SUCCEEDED(hr), "Failed to reset frame, hr %#x.\n", hr);
hr = IDirect3DRMFrame_QueryInterface(frame, &IID_IDirect3DRMFrame3, (void **)&frame3);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMFrame3, hr %#x.\n", hr);
CHECK_REFCOUNT(frame3, 2);
hr = IDirect3DRMAnimation2_SetFrame(animation2, frame3);
ok(SUCCEEDED(hr), "Failed to set a frame, hr %#x.\n", hr);
CHECK_REFCOUNT(frame3, 2);
IDirect3DRMFrame3_Release(frame3);
IDirect3DRMFrame_Release(frame);
IDirect3DRMAnimation2_Release(animation2);
IDirect3DRMAnimation_Release(animation);