Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/d3drm/tests/d3drm.c | 21 +++++++++++++++++++++ dlls/d3drm/viewport.c | 8 ++++++++ 2 files changed, 29 insertions(+)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 0f9f9cd6ed..e826e595d8 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -1733,6 +1733,7 @@ static void test_Viewport(void) RECT rc; DWORD data, ref1, ref2, ref3, ref4; DWORD initial_ref1, initial_ref2, initial_ref3, device_ref, frame_ref, frame_ref2, viewport_ref; + D3DRMPROJECTIONTYPE ptype;
window = create_window(); GetClientRect(window, &rc); @@ -2150,6 +2151,8 @@ static void test_Viewport(void) ok(front == -1.0f, "Got unexpected front %.8e\n", front); back = IDirect3DRMViewport_GetBack(viewport); ok(back == -1.0f, "Got unexpected back %.8e\n", back); + ptype = IDirect3DRMViewport_GetProjection(viewport); + ok(ptype == -1, "Got unexpected projection type %u.\n", ptype);
hr = IDirect3DRMViewport_SetCamera(viewport, frame); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); @@ -2161,6 +2164,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); hr = IDirect3DRMViewport_SetBack(viewport, 100.0f); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DRMViewport_SetProjection(viewport, D3DRMPROJECT_PERSPECTIVE); + 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); @@ -2236,6 +2241,8 @@ static void test_Viewport(void) ok(front == 1.0f, "Got unexpected front %.8e.\n", front); back = IDirect3DRMViewport_GetBack(viewport); ok(back == 100.0f, "Got unexpected back %.8e.\n", back); + ptype = IDirect3DRMViewport_GetProjection(viewport); + ok(ptype == D3DRMPROJECT_PERSPECTIVE, "Got unexpected projection type %u.\n", ptype);
hr = IDirect3DRMViewport_SetField(viewport, 1.0f); ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); @@ -2266,6 +2273,10 @@ static void test_Viewport(void) ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); back = IDirect3DRMViewport_GetBack(viewport); ok(back == 200.0f, "Got unexpected back %.8e.\n", back); + hr = IDirect3DRMViewport_SetProjection(viewport, D3DRMPROJECT_ORTHOGRAPHIC); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + ptype = IDirect3DRMViewport_GetProjection(viewport); + ok(ptype == D3DRMPROJECT_ORTHOGRAPHIC, "Got unexpected projection type %u.\n", ptype);
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); @@ -2333,6 +2344,8 @@ static void test_Viewport(void) ok(front == -1.0f, "Got unexpected front %.8e\n", front); back = IDirect3DRMViewport2_GetBack(viewport2); ok(back == -1.0f, "Got unexpected back %.8e\n", back); + ptype = IDirect3DRMViewport2_GetProjection(viewport2); + ok(ptype == -1, "Got unexpected projection type %u.\n", ptype);
hr = IDirect3DRMViewport2_SetCamera(viewport2, frame3); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); @@ -2344,6 +2357,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); hr = IDirect3DRMViewport2_SetBack(viewport2, 100.0f); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DRMViewport2_SetProjection(viewport2, D3DRMPROJECT_PERSPECTIVE); + 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); @@ -2412,6 +2427,8 @@ static void test_Viewport(void) ok(front == 1.0f, "Got unexpected front %.8e.\n", front); back = IDirect3DRMViewport2_GetBack(viewport2); ok(back == 100.0f, "Got unexpected back %.8e.\n", back); + ptype = IDirect3DRMViewport2_GetProjection(viewport2); + ok(ptype == D3DRMPROJECT_PERSPECTIVE, "Got unexpected projection type %u.\n", ptype);
hr = IDirect3DRMViewport2_SetField(viewport2, 1.0f); ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); @@ -2442,6 +2459,10 @@ static void test_Viewport(void) ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); back = IDirect3DRMViewport2_GetBack(viewport2); ok(back == 200.0f, "Got unexpected back %.8e.\n", back); + hr = IDirect3DRMViewport2_SetProjection(viewport2, D3DRMPROJECT_ORTHOGRAPHIC); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + ptype = IDirect3DRMViewport2_GetProjection(viewport2); + ok(ptype == D3DRMPROJECT_ORTHOGRAPHIC, "Got unexpected projection type %u.\n", ptype);
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); diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index 8e959d5f37..da6b38b110 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -376,6 +376,8 @@ static HRESULT WINAPI d3drm_viewport2_Init(IDirect3DRMViewport2 *iface, IDirect3 viewport->clip.front = 1.0f; viewport->clip.back = 100.0f;
+ viewport->projection = D3DRMPROJECT_PERSPECTIVE; + cleanup:
if (FAILED(hr)) @@ -613,6 +615,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; @@ -975,6 +980,9 @@ static D3DRMPROJECTIONTYPE WINAPI d3drm_viewport2_GetProjection(IDirect3DRMViewp
TRACE("iface %p.\n", iface);
+ if (!viewport->d3d_viewport) + return (D3DRMPROJECTIONTYPE)(-1); + return viewport->projection; }