Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/d3drm/d3drm_private.h | 9 ++++++ dlls/d3drm/tests/d3drm.c | 32 +++++++++++++++++++ dlls/d3drm/viewport.c | 65 ++++++++++++++++++++++++++++---------- 3 files changed, 90 insertions(+), 16 deletions(-)
diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h index 48820b272c..00828d22ab 100644 --- a/dlls/d3drm/d3drm_private.h +++ b/dlls/d3drm/d3drm_private.h @@ -99,6 +99,14 @@ struct d3drm_box float back; };
+struct d3drm_rect +{ + DWORD x; + DWORD y; + DWORD width; + DWORD height; +}; + struct d3drm_viewport { struct d3drm_object obj; @@ -110,6 +118,7 @@ struct d3drm_viewport IDirect3DMaterial *material; IDirect3DRM *d3drm; struct d3drm_box clip; + struct d3drm_rect port; D3DRMPROJECTIONTYPE projection; BOOL uniform_scaling; }; diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 591dc5c0bf..d6f8322813 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2156,6 +2156,14 @@ static void test_Viewport(void) ok(ptype == -1, "Got unexpected projection type %u.\n", ptype); b = IDirect3DRMViewport_GetUniformScaling(viewport); ok(b == -1, "Got unexpected uniform scaling %d.\n", b); + data = IDirect3DRMViewport_GetX(viewport); + ok(data == -1, "Got unexpected X %d.\n", data); + data = IDirect3DRMViewport_GetY(viewport); + ok(data == -1, "Got unexpected Y %d.\n", data); + data = IDirect3DRMViewport_GetWidth(viewport); + ok(data == -1, "Got unexpected width %d.\n", data); + data = IDirect3DRMViewport_GetHeight(viewport); + ok(data == -1, "Got unexpected height %d.\n", data);
hr = IDirect3DRMViewport_SetCamera(viewport, frame); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); @@ -2250,6 +2258,14 @@ static void test_Viewport(void) 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); + data = IDirect3DRMViewport_GetX(viewport); + ok(data == rc.left, "Got unexpected X %d.\n", data); + data = IDirect3DRMViewport_GetY(viewport); + ok(data == rc.top, "Got unexpected Y %d.\n", data); + data = IDirect3DRMViewport_GetWidth(viewport); + ok(data == rc.right, "Got unexpected width %d.\n", data); + data = IDirect3DRMViewport_GetHeight(viewport); + ok(data == rc.bottom, "Got unexpected height %d.\n", data);
hr = IDirect3DRMViewport_SetField(viewport, 1.0f); ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); @@ -2359,6 +2375,14 @@ static void test_Viewport(void) ok(ptype == -1, "Got unexpected projection type %u.\n", ptype); b = IDirect3DRMViewport2_GetUniformScaling(viewport2); ok(b == -1, "Got unexpected uniform scaling %d.\n", b); + data = IDirect3DRMViewport2_GetX(viewport2); + ok(data == -1, "Got unexpected X %d.\n", data); + data = IDirect3DRMViewport2_GetY(viewport2); + ok(data == -1, "Got unexpected Y %d.\n", data); + data = IDirect3DRMViewport2_GetWidth(viewport2); + ok(data == -1, "Got unexpected width %d.\n", data); + data = IDirect3DRMViewport2_GetHeight(viewport2); + ok(data == -1, "Got unexpected height %d.\n", data);
hr = IDirect3DRMViewport2_SetCamera(viewport2, frame3); ok(hr == D3DRMERR_BADOBJECT, "Got unexpected hr %#x.\n", hr); @@ -2446,6 +2470,14 @@ static void test_Viewport(void) 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); + data = IDirect3DRMViewport2_GetX(viewport2); + ok(data == rc.left, "Got unexpected X %d.\n", data); + data = IDirect3DRMViewport2_GetY(viewport2); + ok(data == rc.top, "Got unexpected Y %d.\n", data); + data = IDirect3DRMViewport2_GetWidth(viewport2); + ok(data == rc.right, "Got unexpected width %d.\n", data); + data = IDirect3DRMViewport2_GetHeight(viewport2); + ok(data == rc.bottom, "Got unexpected height %d.\n", data);
hr = IDirect3DRMViewport2_SetField(viewport2, 1.0f); ok(hr == D3DRM_OK, "Got unexpected hr %#x.\n", hr); diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index 7307450772..25a83e6e89 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -380,6 +380,11 @@ static HRESULT WINAPI d3drm_viewport2_Init(IDirect3DRMViewport2 *iface, IDirect3
viewport->uniform_scaling = TRUE;
+ viewport->port.x = x; + viewport->port.y = y; + viewport->port.width = width; + viewport->port.height = height; + cleanup:
if (FAILED(hr)) @@ -874,58 +879,86 @@ static BOOL WINAPI d3drm_viewport1_GetUniformScaling(IDirect3DRMViewport *iface)
static LONG WINAPI d3drm_viewport2_GetX(IDirect3DRMViewport2 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1; + + return viewport->port.x; }
static LONG WINAPI d3drm_viewport1_GetX(IDirect3DRMViewport *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetX(&viewport->IDirect3DRMViewport2_iface); }
static LONG WINAPI d3drm_viewport2_GetY(IDirect3DRMViewport2 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1; + + return viewport->port.y; }
static LONG WINAPI d3drm_viewport1_GetY(IDirect3DRMViewport *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetY(&viewport->IDirect3DRMViewport2_iface); }
static DWORD WINAPI d3drm_viewport2_GetWidth(IDirect3DRMViewport2 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1; + + return viewport->port.width; }
static DWORD WINAPI d3drm_viewport1_GetWidth(IDirect3DRMViewport *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetWidth(&viewport->IDirect3DRMViewport2_iface); }
static DWORD WINAPI d3drm_viewport2_GetHeight(IDirect3DRMViewport2 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1; + + return viewport->port.height; }
static DWORD WINAPI d3drm_viewport1_GetHeight(IDirect3DRMViewport *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- return E_NOTIMPL; + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetHeight(&viewport->IDirect3DRMViewport2_iface); }
static D3DVALUE WINAPI d3drm_viewport2_GetField(IDirect3DRMViewport2 *iface)