[v2 PATCH 1/2] d2d1: Respond to ID2D1Image query

Nikolay Sivov nsivov at codeweavers.com
Wed Nov 22 08:21:05 CST 2017


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

v2: fixed test failure on Vista

 dlls/d2d1/bitmap.c     | 1 +
 dlls/d2d1/tests/d2d1.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 6d9c352924..b03482ae43 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -34,6 +34,7 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_QueryInterface(ID2D1Bitmap *iface, R
     TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
 
     if (IsEqualGUID(iid, &IID_ID2D1Bitmap)
+            || IsEqualGUID(iid, &IID_ID2D1Image)
             || IsEqualGUID(iid, &IID_ID2D1Resource)
             || IsEqualGUID(iid, &IID_IUnknown))
     {
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 3a28e38d67..5116d78d08 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -1476,6 +1476,7 @@ static void test_bitmap_brush(void)
     IDXGISurface *surface;
     ID2D1Factory *factory;
     D2D1_COLOR_F color;
+    ID2D1Image *image;
     D2D1_SIZE_U size;
     unsigned int i;
     ULONG refcount;
@@ -1535,6 +1536,11 @@ static void test_bitmap_brush(void)
     hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
     ok(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
 
+    hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Image, (void **)&image);
+    ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Vista */, "Failed to get ID2D1Image, hr %#x.\n", hr);
+    if (hr == S_OK)
+        ID2D1Image_Release(image);
+
     /* Creating a brush with a NULL bitmap crashes on Vista, but works fine on
      * Windows 7+. */
     hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, &brush);
-- 
2.15.0




More information about the wine-devel mailing list