d3drm: Implement d3drm_viewport2_SetPlane().

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-08-30 23:53:53 +04:30 committed by Alexandre Julliard
parent f3adad102d
commit fe03e3637e
2 changed files with 42 additions and 4 deletions

View File

@ -2151,6 +2151,8 @@ static void test_Viewport(void)
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMViewport_SetField(viewport, 0.5f);
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMViewport_SetPlane(viewport, -0.5f, 0.5f, -0.5f, 0.5f);
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
/* Test all failures together */
hr = IDirect3DRMViewport_Init(viewport, NULL, frame, rc.left, rc.top, rc.right, rc.bottom);
@ -2234,6 +2236,17 @@ static void test_Viewport(void)
ok(bottom == -1.0f, "Got unexpected bottom %.8e.\n", bottom);
ok(top == 1.0f, "Got unexpected top %.8e.\n", top);
hr = IDirect3DRMViewport_SetPlane(viewport, 5.0f, 3.0f, 2.0f, 0.0f);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
field = IDirect3DRMViewport_GetField(viewport);
ok(field == -1.0f, "Got unexpected field %.8e.\n", field);
hr = IDirect3DRMViewport_GetPlane(viewport, &left, &right, &bottom, &top);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
ok(left == 5.0f, "Got unexpected left %.8e.\n", left);
ok(right == 3.0f, "Got unexpected right %.8e.\n", right);
ok(bottom == 2.0f, "Got unexpected bottom %.8e.\n", bottom);
ok(top == 0.0f, "Got unexpected top %.8e.\n", top);
hr = IDirect3DRMViewport_Init(viewport, device1, frame, rc.left, rc.top, rc.right, rc.bottom);
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
hr = IDirect3DRMViewport_GetDevice(viewport, NULL);
@ -2292,6 +2305,8 @@ static void test_Viewport(void)
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMViewport2_SetField(viewport2, 0.5f);
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMViewport2_SetPlane(viewport2, -0.5f, 0.5f, -0.5f, 0.5f);
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMViewport2_Init(viewport2, NULL, frame3, rc.left, rc.top, rc.right, rc.bottom);
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
@ -2368,6 +2383,17 @@ static void test_Viewport(void)
ok(bottom == -1.0f, "Got unexpected bottom %.8e.\n", bottom);
ok(top == 1.0f, "Got unexpected top %.8e.\n", top);
hr = IDirect3DRMViewport2_SetPlane(viewport2, 5.0f, 3.0f, 2.0f, 0.0f);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
field = IDirect3DRMViewport2_GetField(viewport2);
ok(field == -1.0f, "Got unexpected field %.8e.\n", field);
hr = IDirect3DRMViewport2_GetPlane(viewport2, &left, &right, &bottom, &top);
ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr);
ok(left == 5.0f, "Got unexpected left %.8e.\n", left);
ok(right == 3.0f, "Got unexpected right %.8e.\n", right);
ok(bottom == 2.0f, "Got unexpected bottom %.8e.\n", bottom);
ok(top == 0.0f, "Got unexpected top %.8e.\n", top);
hr = IDirect3DRMViewport2_Init(viewport2, device3, frame3, rc.left, rc.top, rc.right, rc.bottom);
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
hr = IDirect3DRMViewport2_GetDevice(viewport2, NULL);

View File

@ -676,19 +676,31 @@ static HRESULT WINAPI d3drm_viewport1_ForceUpdate(IDirect3DRMViewport *iface,
static HRESULT WINAPI d3drm_viewport2_SetPlane(IDirect3DRMViewport2 *iface,
D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top)
{
FIXME("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e stub!\n",
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
TRACE("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e.\n",
iface, left, right, bottom, top);
return E_NOTIMPL;
if (!viewport->d3d_viewport)
return D3DRMERR_BADOBJECT;
viewport->clip.left = left;
viewport->clip.right = right;
viewport->clip.bottom = bottom;
viewport->clip.top = top;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_viewport1_SetPlane(IDirect3DRMViewport *iface,
D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top)
{
FIXME("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e stub!\n",
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
TRACE("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e.\n",
iface, left, right, bottom, top);
return E_NOTIMPL;
return d3drm_viewport2_SetPlane(&viewport->IDirect3DRMViewport2_iface, left, right, bottom, top);
}
static HRESULT WINAPI d3drm_viewport2_GetCamera(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 **camera)