[PATCH] d2d1: Implement GetMaximumBitmapSize().

Nikolay Sivov nsivov at codeweavers.com
Fri Nov 9 11:27:39 CST 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---

For software devices returned values are much higher ranging from 8 * 1024 * 1024 to twice as much.
On actual hardware I get 16384 with our tests, which is d3d11 limit. I think it's better to keep d3d10 limit for now,
until we switch to using d3d11 API.

 dlls/d2d1/device.c     |  4 ++--
 dlls/d2d1/tests/d2d1.c | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 0e96224ec3..7c398962d6 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -1720,9 +1720,9 @@ static D2D1_SIZE_U * STDMETHODCALLTYPE d2d_device_context_GetPixelSize(ID2D1Devi
 
 static UINT32 STDMETHODCALLTYPE d2d_device_context_GetMaximumBitmapSize(ID2D1DeviceContext *iface)
 {
-    FIXME("iface %p stub!\n", iface);
+    TRACE("iface %p.\n", iface);
 
-    return 0;
+    return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
 }
 
 static BOOL STDMETHODCALLTYPE d2d_device_context_IsSupported(ID2D1DeviceContext *iface,
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index b7d3bfa09c..023ea18298 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -4979,6 +4979,7 @@ static void test_dc_target(void)
     ID2D1RenderTarget *rt3;
     ID2D1Factory *factory;
     ID3D10Device1 *device;
+    UINT32 bitmap_size;
     FLOAT dpi_x, dpi_y;
     D2D1_COLOR_F color;
     D2D1_SIZE_U sizeu;
@@ -5186,6 +5187,9 @@ todo_wine
 todo_wine
     ok(clr == RGB(0, 0, 255), "Unexpected color 0x%08x.\n", clr);
 
+    bitmap_size = ID2D1DCRenderTarget_GetMaximumBitmapSize(rt);
+    ok(bitmap_size >= D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION, "Unexpected maximum bitmap size %u.\n", bitmap_size);
+
     DeleteDC(hdc);
     DeleteDC(hdc2);
     ID2D1DCRenderTarget_Release(rt);
@@ -5201,6 +5205,7 @@ static void test_hwnd_target(void)
     ID2D1RenderTarget *rt3;
     ID2D1Factory *factory;
     ID3D10Device1 *device;
+    UINT32 bitmap_size;
     D2D1_SIZE_U size;
     HRESULT hr;
 
@@ -5256,6 +5261,9 @@ static void test_hwnd_target(void)
     hr = ID2D1HwndRenderTarget_Resize(rt, &size);
     ok(SUCCEEDED(hr), "Failed to resize render target, hr %#x.\n", hr);
 
+    bitmap_size = ID2D1HwndRenderTarget_GetMaximumBitmapSize(rt);
+    ok(bitmap_size >= D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION, "Unexpected maximum bitmap size %u.\n", bitmap_size);
+
     ID2D1HwndRenderTarget_Release(rt);
 
     DestroyWindow(hwnd_rt_desc.hwnd);
@@ -5287,6 +5295,7 @@ static void test_compatible_target_size_(unsigned int line, ID2D1RenderTarget *r
     D2D1_SIZE_U pixel_size, expected_size;
     ID2D1BitmapRenderTarget *bitmap_rt;
     ID2D1DeviceContext *context;
+    UINT32 bitmap_size;
     unsigned int i;
     HRESULT hr;
 
@@ -5352,6 +5361,9 @@ static void test_compatible_target_size_(unsigned int line, ID2D1RenderTarget *r
         ID2D1DeviceContext_Release(context);
     }
 
+    bitmap_size = ID2D1BitmapRenderTarget_GetMaximumBitmapSize(bitmap_rt);
+    ok(bitmap_size >= D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION, "Unexpected maximum bitmap size %u.\n", bitmap_size);
+
     ID2D1BitmapRenderTarget_Release(bitmap_rt);
 }
 
@@ -7342,6 +7354,7 @@ static void test_device_context(void)
     ID2D1RenderTarget *rt;
     ID2D1Bitmap1 *bitmap;
     ID2D1Image *target;
+    UINT32 bitmap_size;
     HWND window;
     HRESULT hr;
     RECT rect;
@@ -7522,6 +7535,9 @@ todo_wine
     ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
     ok(bitmap == NULL, "Unexpected target instance.\n");
 
+    bitmap_size = ID2D1DeviceContext_GetMaximumBitmapSize(device_context);
+    ok(bitmap_size >= D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION, "Unexpected maximum bitmap size %u.\n", bitmap_size);
+
     ID2D1DeviceContext_Release(device_context);
     ID2D1DCRenderTarget_Release(dc_rt);
     DeleteDC(hdc);
-- 
2.19.1




More information about the wine-devel mailing list