[PATCH 3/4] d2d1: Derive bitmap options from surface description in CreateSharedBitmap().

Nikolay Sivov wine at gitlab.winehq.org
Tue May 31 06:15:38 CDT 2022


From: Nikolay Sivov <nsivov at codeweavers.com>

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/d2d1/bitmap.c     | 1 +
 dlls/d2d1/device.c     | 5 ++++-
 dlls/d2d1/tests/d2d1.c | 1 -
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 097d984e3ae..cebabbe4a61 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -616,6 +616,7 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid,
         {
             memset(&d, 0, sizeof(d));
             d.pixelFormat.format = surface_desc.Format;
+            d.bitmapOptions = d2d_get_bitmap_options_for_surface(surface);
         }
         else
         {
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 64b573da974..b7faf33e266 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -405,7 +405,10 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateSharedBitmap(ID2D1Devi
     if (desc)
     {
         memcpy(&bitmap_desc, desc, sizeof(*desc));
-        bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
+        if (IsEqualIID(iid, &IID_IDXGISurface) || IsEqualIID(iid, &IID_IDXGISurface1))
+            bitmap_desc.bitmapOptions = d2d_get_bitmap_options_for_surface(data);
+        else
+            bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
         bitmap_desc.colorContext = NULL;
     }
 
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 515c14e5adb..5185c07c29b 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -11772,7 +11772,6 @@ static void test_bitmap_map(BOOL d3d11)
     hr = ID2D1Bitmap_QueryInterface(bitmap2, &IID_ID2D1Bitmap1, (void **)&bitmap);
     ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
     options = ID2D1Bitmap1_GetOptions(bitmap);
-    todo_wine
     ok(options == (D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ),
             "Unexpected options %#x.\n", options);
 
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/161



More information about the wine-devel mailing list