Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/d3drm/d3drm_private.h | 1 + dlls/d3drm/tests/d3drm.c | 21 +++++++++++++++++++++ dlls/d3drm/viewport.c | 34 ++++++++++++++++++++++++++-------- 3 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h index b5d60e518f..48820b272c 100644 --- a/dlls/d3drm/d3drm_private.h +++ b/dlls/d3drm/d3drm_private.h @@ -111,6 +111,7 @@ struct d3drm_viewport IDirect3DRM *d3drm; struct d3drm_box clip; D3DRMPROJECTIONTYPE projection; + BOOL uniform_scaling; };
struct d3drm_device diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index e826e595d8..591dc5c0bf 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -1734,6 +1734,7 @@ static void test_Viewport(void) DWORD data, ref1, ref2, ref3, ref4; DWORD initial_ref1, initial_ref2, initial_ref3, device_ref, frame_ref, frame_ref2, viewport_ref; D3DRMPROJECTIONTYPE ptype; + BOOL b;
window = create_window(); GetClientRect(window, &rc); @@ -2153,6 +2154,8 @@ static void test_Viewport(void) ok(back == -1.0f, "Got unexpected back %.8e\n", back); ptype = IDirect3DRMViewport_GetProjection(viewport); ok(ptype == -1, "Got unexpected projection type %u.\n", ptype); + b = IDirect3DRMViewport_GetUniformScaling(viewport); + ok(b == -1, "Got unexpected uniform scaling %d.\n", b);
hr = IDirect3DRMViewport_SetCamera(viewport, frame); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); @@ -2166,6 +2169,8 @@ static void test_Viewport(void) 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); + hr = IDirect3DRMViewport_SetUniformScaling(viewport, TRUE); + 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); @@ -2243,6 +2248,8 @@ static void test_Viewport(void) 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); + b = IDirect3DRMViewport_GetUniformScaling(viewport); + ok(b == TRUE, "Got unexpected uniform scaling %d.\n", b);
hr = IDirect3DRMViewport_SetField(viewport, 1.0f); ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); @@ -2277,6 +2284,10 @@ static void test_Viewport(void) 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_SetUniformScaling(viewport, FALSE); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + b = IDirect3DRMViewport_GetUniformScaling(viewport); + ok(b == FALSE, "Got unexpected uniform scaling %d.\n", b);
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); @@ -2346,6 +2357,8 @@ static void test_Viewport(void) ok(back == -1.0f, "Got unexpected back %.8e\n", back); ptype = IDirect3DRMViewport2_GetProjection(viewport2); ok(ptype == -1, "Got unexpected projection type %u.\n", ptype); + b = IDirect3DRMViewport2_GetUniformScaling(viewport2); + ok(b == -1, "Got unexpected uniform scaling %d.\n", b);
hr = IDirect3DRMViewport2_SetCamera(viewport2, frame3); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); @@ -2359,6 +2372,8 @@ static void test_Viewport(void) 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_SetUniformScaling(viewport2, TRUE); + 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); @@ -2429,6 +2444,8 @@ static void test_Viewport(void) 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); + b = IDirect3DRMViewport2_GetUniformScaling(viewport2); + ok(b == TRUE, "Got unexpected uniform scaling %d.\n", b);
hr = IDirect3DRMViewport2_SetField(viewport2, 1.0f); ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); @@ -2463,6 +2480,10 @@ static void test_Viewport(void) 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_SetUniformScaling(viewport2, FALSE); + ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); + b = IDirect3DRMViewport2_GetUniformScaling(viewport2); + ok(b == FALSE, "Got unexpected uniform scaling %d.\n", b);
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 da6b38b110..7307450772 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -378,6 +378,8 @@ static HRESULT WINAPI d3drm_viewport2_Init(IDirect3DRMViewport2 *iface, IDirect3
viewport->projection = D3DRMPROJECT_PERSPECTIVE;
+ viewport->uniform_scaling = TRUE; + cleanup:
if (FAILED(hr)) @@ -569,16 +571,25 @@ static HRESULT WINAPI d3drm_viewport1_SetField(IDirect3DRMViewport *iface, D3DVA
static HRESULT WINAPI d3drm_viewport2_SetUniformScaling(IDirect3DRMViewport2 *iface, BOOL b) { - FIXME("iface %p, b %#x stub!\n", iface, b); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
- return E_NOTIMPL; + TRACE("iface %p, b %#x.\n", iface, b); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + viewport->uniform_scaling = b; + + return D3DRM_OK; }
static HRESULT WINAPI d3drm_viewport1_SetUniformScaling(IDirect3DRMViewport *iface, BOOL b) { - FIXME("iface %p, b %#x stub!\n", iface, b); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- return E_NOTIMPL; + TRACE("iface %p, b %#x.\n", iface, b); + + return d3drm_viewport2_SetUniformScaling(&viewport->IDirect3DRMViewport2_iface, b); }
static HRESULT WINAPI d3drm_viewport2_SetCamera(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 *camera) @@ -842,16 +853,23 @@ static HRESULT WINAPI d3drm_viewport1_Pick(IDirect3DRMViewport *iface,
static BOOL WINAPI d3drm_viewport2_GetUniformScaling(IDirect3DRMViewport2 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
- return FALSE; + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1; + + return viewport->uniform_scaling; }
static BOOL WINAPI d3drm_viewport1_GetUniformScaling(IDirect3DRMViewport *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface);
- return FALSE; + return d3drm_viewport2_GetUniformScaling(&viewport->IDirect3DRMViewport2_iface); }
static LONG WINAPI d3drm_viewport2_GetX(IDirect3DRMViewport2 *iface)