Commit fdd6a07a authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d2d1: Allow setting command list as a target.

parent 753ae1d0
......@@ -117,3 +117,11 @@ HRESULT d2d_command_list_create(ID2D1Factory *factory, struct d2d_command_list *
return S_OK;
}
struct d2d_command_list *unsafe_impl_from_ID2D1CommandList(ID2D1CommandList *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == (ID2D1CommandListVtbl *)&d2d_command_list_vtbl);
return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface);
}
......@@ -152,6 +152,13 @@ enum d2d_device_context_sampler_limits
D2D_SAMPLER_EXTEND_MODE_COUNT = 3,
};
enum d2d_device_context_target_type
{
D2D_TARGET_UNKNOWN = 0,
D2D_TARGET_BITMAP,
D2D_TARGET_COMMAND_LIST,
};
struct d2d_device_context
{
ID2D1DeviceContext1 ID2D1DeviceContext1_iface;
......@@ -167,7 +174,16 @@ struct d2d_device_context
ID2D1Device *device;
ID3D11Device1 *d3d_device;
ID3DDeviceContextState *d3d_state;
struct d2d_bitmap *target;
struct
{
ID2D1Image *object;
enum d2d_device_context_target_type type;
union
{
struct d2d_bitmap *bitmap;
struct d2d_command_list *command_list;
};
} target;
struct d2d_shape_resources shape_resources[D2D_SHAPE_TYPE_COUNT];
ID3D11Buffer *vs_cb;
ID3D11PixelShader *ps;
......@@ -698,6 +714,7 @@ struct d2d_command_list
};
HRESULT d2d_command_list_create(ID2D1Factory *factory, struct d2d_command_list **command_list) DECLSPEC_HIDDEN;
struct d2d_command_list *unsafe_impl_from_ID2D1CommandList(ID2D1CommandList *iface) DECLSPEC_HIDDEN;
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
{
......
......@@ -9444,6 +9444,7 @@ static void test_command_list(BOOL d3d11)
ID2D1StrokeStyle *stroke_style;
ID2D1CommandList *command_list;
struct d2d1_test_context ctx;
D2D1_PIXEL_FORMAT format;
ID2D1Geometry *geometry;
ID2D1RenderTarget *rt;
D2D1_POINT_2F p0, p1;
......@@ -9472,6 +9473,15 @@ static void test_command_list(BOOL d3d11)
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)command_list);
size = ID2D1DeviceContext_GetPixelSize(device_context);
ok(!size.width, "Got unexpected width %u.\n", size.width);
ok(!size.height, "Got unexpected height %u.\n", size.height);
format = ID2D1DeviceContext_GetPixelFormat(device_context);
ok(format.format == DXGI_FORMAT_UNKNOWN && format.alphaMode == D2D1_ALPHA_MODE_UNKNOWN,
"Unexpected format %u, alpha mode %u.\n", format.format, format.alphaMode);
ID2D1DeviceContext_BeginDraw(device_context);
hr = ID2D1DeviceContext_QueryInterface(device_context, &IID_ID2D1RenderTarget, (void **)&rt);
......@@ -9627,7 +9637,6 @@ static void test_command_list(BOOL d3d11)
/* Close on attached list. */
ID2D1DeviceContext_GetTarget(device_context, &target);
todo_wine
ok(target == (ID2D1Image *)command_list, "Unexpected context target.\n");
ID2D1Image_Release(target);
......@@ -9665,7 +9674,9 @@ static void test_command_list(BOOL d3d11)
ID2D1DeviceContext_SetTarget(device_context2, (ID2D1Image *)command_list);
ID2D1DeviceContext_GetTarget(device_context2, &target);
todo_wine
ok(target == NULL, "Unexpected target.\n");
if (target) ID2D1Image_Release(target);
ID2D1CommandList_Release(command_list);
ID2D1DeviceContext_Release(device_context2);
......
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