Commit 828a7aa0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d2d1: Use bitmap options to check if mapping is supported.

parent f185a3ac
......@@ -257,6 +257,9 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_Map(ID2D1Bitmap1 *iface, D2D1_MAP_OP
TRACE("iface %p, options %#x, mapped_rect %p.\n", iface, options, mapped_rect);
if (!(bitmap->options & D2D1_BITMAP_OPTIONS_CPU_READ))
return E_INVALIDARG;
if (bitmap->mapped_resource.pData)
return D2DERR_WRONG_STATE;
......
......@@ -11804,6 +11804,14 @@ static void test_bitmap_map(BOOL d3d11)
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
if (SUCCEEDED(hr)) ID2D1Bitmap1_Release(bitmap);
/* Create without D2D1_BITMAP_OPTIONS_CPU_READ, surface supports CPU reads. */
bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect);
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
ID2D1Bitmap1_Release(bitmap);
ID3D11Texture2D_Release(texture);
IDXGISurface_Release(surface);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment