d3drm: Implement d3drm_frame3_AddScale().

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jeff Smith 2019-06-20 02:29:53 +04:30 committed by Alexandre Julliard
parent 11fe8e4b6a
commit 06321dcb1d
2 changed files with 98 additions and 6 deletions

View File

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

View File

@ -2870,6 +2870,51 @@ static void test_frame_transform(void)
0.0f, 0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 2.0f, 0.0f,
3.0f, 3.0f, 3.0f, 1.0f, 1); 3.0f, 3.0f, 3.0f, 1.0f, 1);
frame_set_transform(frame,
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);
hr = IDirect3DRMFrame_AddScale(frame, D3DRMCOMBINE_REPLACE, 2.0f, 2.0f, 2.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,
0.0f, 0.0f, 0.0f, 1.0f, 1);
frame_set_transform(frame,
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);
hr = IDirect3DRMFrame_AddScale(frame, D3DRMCOMBINE_BEFORE, 2.0f, 2.0f, 2.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);
frame_set_transform(frame,
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);
hr = IDirect3DRMFrame_AddScale(frame, D3DRMCOMBINE_AFTER, 2.0f, 2.0f, 2.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);
IDirect3DRMFrame_Release(frame); IDirect3DRMFrame_Release(frame);
IDirect3DRM_Release(d3drm); IDirect3DRM_Release(d3drm);
} }