d3drm: Return D3DRMERR_BADOBJECT from d3drm_viewport2_SetProjection() for uninitialised viewports.

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 2020-01-28 16:17:42 +03:30 committed by Alexandre Julliard
parent f4bdc4386c
commit afb09525b5
2 changed files with 5 additions and 2 deletions

View File

@ -2165,7 +2165,7 @@ static void test_Viewport(void)
hr = IDirect3DRMViewport_SetBack(viewport, 100.0f);
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMViewport_SetProjection(viewport, D3DRMPROJECT_PERSPECTIVE);
todo_wine ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
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);
@ -2358,7 +2358,7 @@ static void test_Viewport(void)
hr = IDirect3DRMViewport2_SetBack(viewport2, 100.0f);
ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMViewport2_SetProjection(viewport2, D3DRMPROJECT_PERSPECTIVE);
todo_wine ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr);
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);

View File

@ -613,6 +613,9 @@ static HRESULT WINAPI d3drm_viewport2_SetProjection(IDirect3DRMViewport2 *iface,
TRACE("iface %p, type %#x.\n", iface, type);
if (!viewport->d3d_viewport)
return D3DRMERR_BADOBJECT;
viewport->projection = type;
return D3DRM_OK;