d3drm: Implement d3drm_frame3_AddTranslation().

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jeff Smith 2019-06-20 02:29:52 +04:30 committed by Alexandre Julliard
parent 5309648553
commit 11fe8e4b6a
2 changed files with 83 additions and 6 deletions

View File

@ -1022,25 +1022,57 @@ static HRESULT WINAPI d3drm_frame1_AddTransform(IDirect3DRMFrame *iface,
static HRESULT WINAPI d3drm_frame3_AddTranslation(IDirect3DRMFrame3 *iface,
D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e stub!\n", iface, type, x, y, z);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
return E_NOTIMPL;
TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z);
switch (type)
{
case D3DRMCOMBINE_REPLACE:
frame->transform = identity;
frame->transform._41 = x;
frame->transform._42 = y;
frame->transform._43 = z;
break;
case D3DRMCOMBINE_BEFORE:
frame->transform._41 += x * frame->transform._11 + y * frame->transform._21 + z * frame->transform._31;
frame->transform._42 += x * frame->transform._12 + y * frame->transform._22 + z * frame->transform._32;
frame->transform._43 += x * frame->transform._13 + y * frame->transform._23 + z * frame->transform._33;
break;
case D3DRMCOMBINE_AFTER:
frame->transform._41 += x;
frame->transform._42 += y;
frame->transform._43 += z;
break;
default:
FIXME("Unhandled type %#x.\n", type);
return D3DRMERR_BADVALUE;
}
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_frame2_AddTranslation(IDirect3DRMFrame2 *iface,
D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e stub!\n", iface, type, x, y, z);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
return E_NOTIMPL;
TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z);
return d3drm_frame3_AddTranslation(&frame->IDirect3DRMFrame3_iface, type, x, y, z);
}
static HRESULT WINAPI d3drm_frame1_AddTranslation(IDirect3DRMFrame *iface,
D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e stub!\n", iface, type, x, y, z);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
return E_NOTIMPL;
TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z);
return d3drm_frame3_AddTranslation(&frame->IDirect3DRMFrame3_iface, type, x, y, z);
}
static HRESULT WINAPI d3drm_frame3_AddScale(IDirect3DRMFrame3 *iface,

View File

@ -2825,6 +2825,51 @@ static void test_frame_transform(void)
hr = IDirect3DRMFrame_AddTransform(frame, D3DRMCOMBINE_REPLACE, add_matrix);
ok(hr == D3DRMERR_BADVALUE, "Got unexpected hr %#x.\n", hr);
frame_set_transform(frame,
2.0f, 0.0f, 0.0f, 0.0f,
0.0f, 2.0f, 0.0f, 0.0f,
0.0f, 0.0f, 2.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
hr = IDirect3DRMFrame_AddTranslation(frame, D3DRMCOMBINE_REPLACE, 3.0f, 3.0f, 3.0f);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMFrame_GetTransform(frame, matrix);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
expect_matrix(matrix,
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
3.0f, 3.0f, 3.0f, 1.0f, 1);
frame_set_transform(frame,
2.0f, 0.0f, 0.0f, 0.0f,
0.0f, 2.0f, 0.0f, 0.0f,
0.0f, 0.0f, 2.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
hr = IDirect3DRMFrame_AddTranslation(frame, D3DRMCOMBINE_BEFORE, 3.0f, 3.0f, 3.0f);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMFrame_GetTransform(frame, matrix);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
expect_matrix(matrix,
2.0f, 0.0f, 0.0f, 0.0f,
0.0f, 2.0f, 0.0f, 0.0f,
0.0f, 0.0f, 2.0f, 0.0f,
6.0f, 6.0f, 6.0f, 1.0f, 1);
frame_set_transform(frame,
2.0f, 0.0f, 0.0f, 0.0f,
0.0f, 2.0f, 0.0f, 0.0f,
0.0f, 0.0f, 2.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
hr = IDirect3DRMFrame_AddTranslation(frame, D3DRMCOMBINE_AFTER, 3.0f, 3.0f, 3.0f);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMFrame_GetTransform(frame, matrix);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
expect_matrix(matrix,
2.0f, 0.0f, 0.0f, 0.0f,
0.0f, 2.0f, 0.0f, 0.0f,
0.0f, 0.0f, 2.0f, 0.0f,
3.0f, 3.0f, 3.0f, 1.0f, 1);
IDirect3DRMFrame_Release(frame);
IDirect3DRM_Release(d3drm);
}