From: Jeff Smith whydoubt@gmail.com
--- dlls/d3drm/tests/d3drm.c | 78 ++++++++++++++++++++-------------------- dlls/d3drm/viewport.c | 24 ++++++++++--- 2 files changed, 59 insertions(+), 43 deletions(-)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index b9367f67d34..7b60efa1965 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -8319,27 +8319,27 @@ static void test_update_1(void)
/* Area cannot extend beyond viewport */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left - 1, vrect.top, vrect.right - 1, vrect.bottom); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top - 1, vrect.right, vrect.bottom - 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left + 1, vrect.top, vrect.right + 1, vrect.bottom); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top + 1, vrect.right, vrect.bottom + 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); /* Point 1 cannot be left of or above Point 2 */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left + 1, vrect.top, vrect.left, vrect.top + 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top + 1, vrect.left + 1, vrect.top); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left + 1, vrect.top + 1, vrect.left, vrect.top); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); /* Anything else is allowed, including a single point */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.left, vrect.top); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.left + 1, vrect.top + 1); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); /* Update just to flush force updates */ hr = IDirect3DRMDevice_Update(device1); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice, hr %#lx.\n", hr); @@ -8348,7 +8348,7 @@ static void test_update_1(void) ctx.rect.x1 = ctx.rect.y1 = ctx.rect.x2 = ctx.rect.y2 = ~0; ctx.rect_count = -1; hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice_AddUpdateCallback(device1, update_cb_modify_rect, NULL); todo_wine ok(hr == D3DRM_OK, "Cannot add update callback, hr %#lx.\n", hr); hr = IDirect3DRMDevice_AddUpdateCallback(device1, update_cb_get_rect, &ctx); @@ -8453,27 +8453,27 @@ static void test_update_2(void)
/* Area cannot extend beyond viewport */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left - 1, vrect.top, vrect.right - 1, vrect.bottom); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top - 1, vrect.right, vrect.bottom - 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left + 1, vrect.top, vrect.right + 1, vrect.bottom); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top + 1, vrect.right, vrect.bottom + 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); /* Point 1 cannot be left of or above Point 2 */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left + 1, vrect.top, vrect.left, vrect.top + 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top + 1, vrect.left + 1, vrect.top); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left + 1, vrect.top + 1, vrect.left, vrect.top); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); /* Anything else is allowed, including a single point */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.left, vrect.top); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.left + 1, vrect.top + 1); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); /* Update just to flush force updates */ hr = IDirect3DRMDevice2_Update(device2); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice2, hr %#lx.\n", hr); @@ -8482,7 +8482,7 @@ static void test_update_2(void) ctx.rect.x1 = ctx.rect.y1 = ctx.rect.x2 = ctx.rect.y2 = ~0; ctx.rect_count = -1; hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice2_AddUpdateCallback(device2, update_cb_modify_rect, NULL); todo_wine ok(hr == D3DRM_OK, "Cannot add update callback, hr %#lx.\n", hr); hr = IDirect3DRMDevice2_AddUpdateCallback(device2, update_cb_get_rect, &ctx); @@ -8583,27 +8583,27 @@ static void test_update_3(void)
/* Area cannot extend beyond viewport */ hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left - 1, vrect.top, vrect.right - 1, vrect.bottom); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top - 1, vrect.right, vrect.bottom - 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left + 1, vrect.top, vrect.right + 1, vrect.bottom); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top + 1, vrect.right, vrect.bottom + 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); /* Point 1 cannot be left of or above Point 2 */ hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left + 1, vrect.top, vrect.left, vrect.top + 1); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top + 1, vrect.left + 1, vrect.top); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left + 1, vrect.top + 1, vrect.left, vrect.top); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected bad value from force update, hr %#lx.\n", hr); /* Anything else is allowed, including a single point */ hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top, vrect.left, vrect.top); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top, vrect.left + 1, vrect.top + 1); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); /* Update just to flush force updates */ hr = IDirect3DRMDevice3_Update(device3); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice3, hr %#lx.\n", hr); @@ -8612,7 +8612,7 @@ static void test_update_3(void) ctx.rect.x1 = ctx.rect.y1 = ctx.rect.x2 = ctx.rect.y2 = ~0; ctx.rect_count = -1; hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice3_AddUpdateCallback(device3, update_cb_modify_rect, NULL); todo_wine ok(hr == D3DRM_OK, "Cannot add update callback, hr %#lx.\n", hr); hr = IDirect3DRMDevice3_AddUpdateCallback(device3, update_cb_get_rect, &ctx); @@ -8759,7 +8759,7 @@ static void test_update_surfaces_1(void)
/* Update modifies primary surface following a force update */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice_Update(device1); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice, hr %#lx.\n", hr); ret_color = get_surface_color(d3drm_primary, 320 + client_pos.x, 240 + client_pos.y); @@ -8806,7 +8806,7 @@ static void test_update_surfaces_1(void) free(clip_list); set_surface_color(surface, 320, 240, 0x0000ff00); hr = IDirect3DRMViewport_ForceUpdate(viewport, 320, 240, 321, 241); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice_Update(device1); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice, hr %#lx.\n", hr); ret_color = get_surface_color(d3drm_primary, 320 + client_pos.x, 240 + client_pos.y); @@ -8928,7 +8928,7 @@ static void test_update_surfaces_2(void)
/* Update modifies primary surface following a force update */ hr = IDirect3DRMViewport_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice_Update(device2); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice2, hr %#lx.\n", hr); ret_color = get_surface_color(d3drm_primary, 320 + client_pos.x, 240 + client_pos.y); @@ -8975,7 +8975,7 @@ static void test_update_surfaces_2(void) free(clip_list); set_surface_color(surface, 320, 240, 0x0000ff00); hr = IDirect3DRMViewport_ForceUpdate(viewport, 320, 240, 321, 241); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice2_Update(device2); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice2, hr %#lx.\n", hr); ret_color = get_surface_color(d3drm_primary, 320 + client_pos.x, 240 + client_pos.y); @@ -9093,7 +9093,7 @@ static void test_update_surfaces_3(void)
/* Update modifies primary surface following a force update */ hr = IDirect3DRMViewport2_ForceUpdate(viewport, vrect.left, vrect.top, vrect.right, vrect.bottom); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice3_Update(device3); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice3, hr %#lx.\n", hr); ret_color = get_surface_color(d3drm_primary, 320 + client_pos.x, 240 + client_pos.y); @@ -9140,7 +9140,7 @@ static void test_update_surfaces_3(void) free(clip_list); set_surface_color(surface, 320, 240, 0x0000ff00); hr = IDirect3DRMViewport2_ForceUpdate(viewport, 320, 240, 321, 241); - todo_wine ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); + ok(hr == D3DRM_OK, "Cannot force update of viewport, hr %#lx.\n", hr); hr = IDirect3DRMDevice3_Update(device3); ok(hr == D3DRM_OK, "Cannot update Direct3DRMDevice3, hr %#lx.\n", hr); ret_color = get_surface_color(d3drm_primary, 320 + client_pos.x, 240 + client_pos.y); diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index 821eb1ff12c..528cae24001 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -677,17 +677,33 @@ static HRESULT WINAPI d3drm_viewport1_Configure(IDirect3DRMViewport *iface, static HRESULT WINAPI d3drm_viewport2_ForceUpdate(IDirect3DRMViewport2* iface, DWORD x1, DWORD y1, DWORD x2, DWORD y2) { - FIXME("iface %p, x1 %lu, y1 %lu, x2 %lu, y2 %lu stub!\n", iface, x1, y1, x2, y2); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + D3DVIEWPORT vp = { sizeof(vp) }; + HRESULT hr;
- return E_NOTIMPL; + TRACE("iface %p, x1 %lu, y1 %lu, x2 %lu, y2 %lu.\n", iface, x1, y1, x2, y2); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + if (FAILED(hr = IDirect3DViewport_GetViewport(viewport->d3d_viewport, &vp))) + return hr; + + if (x1 > x2 || y1 > y2 || x1 < vp.dwX || y1 < vp.dwY || + x2 > (vp.dwX + vp.dwWidth) || y2 > (vp.dwY + vp.dwHeight)) + return D3DRMERR_BADVALUE; + + return D3DRM_OK; }
static HRESULT WINAPI d3drm_viewport1_ForceUpdate(IDirect3DRMViewport *iface, DWORD x1, DWORD y1, DWORD x2, DWORD y2) { - FIXME("iface %p, x1 %lu, y1 %lu, x2 %lu, y2 %lu stub!\n", iface, x1, y1, x2, y2); + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- return E_NOTIMPL; + TRACE("iface %p, x1 %lu, y1 %lu, x2 %lu, y2 %lu.\n", iface, x1, y1, x2, y2); + + return d3drm_viewport2_ForceUpdate(&viewport->IDirect3DRMViewport2_iface, x1, y1, x2, y2); }
static HRESULT WINAPI d3drm_viewport2_SetPlane(IDirect3DRMViewport2 *iface,