From a1dadf3683e9961f4fa2dee138faea804cddcd49 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 7 May 2024 23:13:32 +0200 Subject: [PATCH] d2d1/effect: Fix GetImageLocalBounds() prototype. Signed-off-by: Nikolay Sivov --- dlls/d2d1/device.c | 6 +++++- dlls/d2d1/tests/d2d1.c | 16 +++++++++++----- include/d2d1_1.idl | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 153c79583c7..8b1099b180b 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -2292,7 +2292,7 @@ static BOOL STDMETHODCALLTYPE d2d_device_context_IsBufferPrecisionSupported(ID2D return !!(support & D3D11_FORMAT_SUPPORT_BUFFER); } -static void STDMETHODCALLTYPE d2d_device_context_GetImageLocalBounds(ID2D1DeviceContext6 *iface, +static HRESULT STDMETHODCALLTYPE d2d_device_context_GetImageLocalBounds(ID2D1DeviceContext6 *iface, ID2D1Image *image, D2D1_RECT_F *local_bounds) { struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); @@ -2325,10 +2325,14 @@ static void STDMETHODCALLTYPE d2d_device_context_GetImageLocalBounds(ID2D1Device break; } ID2D1Bitmap_Release(bitmap); + + return S_OK; } else { FIXME("Unable to get local bounds of image %p.\n", image); + + return E_NOTIMPL; } } diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 5b74650ee46..9ae815dcc64 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -12481,7 +12481,8 @@ static void test_effect_2d_affine(BOOL d3d11) } ID2D1Effect_GetOutput(effect, &output); - ID2D1DeviceContext_GetImageLocalBounds(context, output, &output_bounds); + hr = ID2D1DeviceContext_GetImageLocalBounds(context, output, &output_bounds); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); todo_wine ok(compare_rect(&output_bounds, test->bounds.left, test->bounds.top, test->bounds.right, test->bounds.bottom, 1), "Got unexpected output bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", @@ -12603,7 +12604,9 @@ static void test_effect_crop(BOOL d3d11) ID2D1Effect_GetOutput(effect, &output); set_rect(&output_bounds, -1.0f, -1.0f, -1.0f, -1.0f); - ID2D1DeviceContext_GetImageLocalBounds(context, output, &output_bounds); + hr = ID2D1DeviceContext_GetImageLocalBounds(context, output, &output_bounds); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); todo_wine ok(compare_rect(&output_bounds, test->bounds.left, test->bounds.top, test->bounds.right, test->bounds.bottom, 0), "Got unexpected output bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", @@ -13650,7 +13653,8 @@ static void test_image_bounds(BOOL d3d11) set_rect(&bounds, 0.0f, 0.0f, 0.0f, 0.0f); size = ID2D1Bitmap_GetSize(bitmap); - ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + hr = ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height); @@ -13658,7 +13662,8 @@ static void test_image_bounds(BOOL d3d11) /* Test bitmap local bounds after changing context dpi */ ID2D1DeviceContext_GetDpi(context, &dpi_x, &dpi_y); ID2D1DeviceContext_SetDpi(context, dpi_x * 2.0f, dpi_y * 2.0f); - ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + hr = ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height); @@ -13668,7 +13673,8 @@ static void test_image_bounds(BOOL d3d11) unit_mode = ID2D1DeviceContext_GetUnitMode(context); ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", unit_mode); ID2D1DeviceContext_SetUnitMode(context, D2D1_UNIT_MODE_PIXELS); - ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + hr = ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(compare_rect(&bounds, 0.0f, 0.0f, test->pixel_size.width, test->pixel_size.height, 0), "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index 9da56050ecb..5560f24a38e 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -798,7 +798,7 @@ interface ID2D1DeviceContext : ID2D1RenderTarget BOOL IsBufferPrecisionSupported( [in] D2D1_BUFFER_PRECISION buffer_precision ); - void GetImageLocalBounds( + HRESULT GetImageLocalBounds( [in] ID2D1Image *image, [out] D2D1_RECT_F *local_bounds );