diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c index e4b71ce0108..9399c3e528d 100644 --- a/dlls/d2d1/command_list.c +++ b/dlls/d2d1/command_list.c @@ -32,6 +32,7 @@ enum d2d_command_type D2D_COMMAND_DRAW_LINE, D2D_COMMAND_DRAW_GEOMETRY, D2D_COMMAND_DRAW_RECTANGLE, + D2D_COMMAND_FILL_GEOMETRY, D2D_COMMAND_PUSH_CLIP, D2D_COMMAND_POP_CLIP, }; @@ -118,6 +119,14 @@ struct d2d_command_draw_rectangle ID2D1StrokeStyle *stroke_style; }; +struct d2d_command_fill_geometry +{ + struct d2d_command c; + ID2D1Geometry *geometry; + ID2D1Brush *brush; + ID2D1Brush *opacity_brush; +}; + static inline struct d2d_command_list *impl_from_ID2D1CommandList(ID2D1CommandList *iface) { return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface); @@ -267,6 +276,12 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface c->stroke_style); break; } + case D2D_COMMAND_FILL_GEOMETRY: + { + const struct d2d_command_fill_geometry *c = data; + hr = ID2D1CommandSink_FillGeometry(sink, c->geometry, c->brush, c->opacity_brush); + break; + } case D2D_COMMAND_PUSH_CLIP: { const struct d2d_command_push_clip *c = data; @@ -609,3 +624,33 @@ void d2d_command_list_draw_rectangle(struct d2d_command_list *command_list, cons command->stroke_width = stroke_width; command->stroke_style = stroke_style; } + +void d2d_command_list_fill_geometry(struct d2d_command_list *command_list, + const struct d2d_device_context *context, ID2D1Geometry *geometry, ID2D1Brush *orig_brush, + ID2D1Brush *orig_opacity_brush) +{ + ID2D1Brush *brush, *opacity_brush = NULL; + struct d2d_command_fill_geometry *command; + + if (FAILED(d2d_command_list_create_brush(command_list, context, orig_brush, &brush))) + { + command_list->state = D2D_COMMAND_LIST_STATE_ERROR; + return; + } + + if (orig_opacity_brush && FAILED(d2d_command_list_create_brush(command_list, context, + orig_opacity_brush, &opacity_brush))) + { + command_list->state = D2D_COMMAND_LIST_STATE_ERROR; + ID2D1Brush_Release(brush); + return; + } + + d2d_command_list_reference_object(command_list, geometry); + + command = d2d_command_list_require_space(command_list, sizeof(*command)); + command->c.op = D2D_COMMAND_FILL_GEOMETRY; + command->geometry = geometry; + command->brush = brush; + command->opacity_brush = opacity_brush; +} diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 4e39ff39960..0651e83d9d1 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -754,6 +754,9 @@ void d2d_command_list_draw_geometry(struct d2d_command_list *command_list, float stroke_width, ID2D1StrokeStyle *stroke_style) DECLSPEC_HIDDEN; void d2d_command_list_draw_rectangle(struct d2d_command_list *command_list, const struct d2d_device_context *context, const D2D1_RECT_F *rect, ID2D1Brush *orig_brush, float stroke_width, ID2D1StrokeStyle *stroke_style) DECLSPEC_HIDDEN; +void d2d_command_list_fill_geometry(struct d2d_command_list *command_list, + const struct d2d_device_context *context, ID2D1Geometry *geometry, ID2D1Brush *orig_brush, + ID2D1Brush *orig_opacity_brush) DECLSPEC_HIDDEN; static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) { diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 13321fa04c6..8e9b236e2af 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1066,12 +1066,6 @@ static void STDMETHODCALLTYPE d2d_device_context_FillGeometry(ID2D1DeviceContext TRACE("iface %p, geometry %p, brush %p, opacity_brush %p.\n", iface, geometry, brush, opacity_brush); - if (context->target.type == D2D_TARGET_COMMAND_LIST) - { - FIXME("Unimplemented for command list target.\n"); - return; - } - if (FAILED(context->error.code)) return; @@ -1081,7 +1075,10 @@ static void STDMETHODCALLTYPE d2d_device_context_FillGeometry(ID2D1DeviceContext return; } - d2d_device_context_fill_geometry(context, geometry_impl, brush_impl, opacity_brush_impl); + if (context->target.type == D2D_TARGET_COMMAND_LIST) + d2d_command_list_fill_geometry(context->target.command_list, context, geometry, brush, opacity_brush); + else + d2d_device_context_fill_geometry(context, geometry_impl, brush_impl, opacity_brush_impl); } static void STDMETHODCALLTYPE d2d_device_context_FillMesh(ID2D1DeviceContext1 *iface, diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 44b762fd0b0..3137d5c13c2 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9553,11 +9553,9 @@ static void test_command_list(BOOL d3d11) ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount); refcount = ID2D1Geometry_Release(geometry); - todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); refcount = ID2D1GradientStopCollection_Release(gradient); - todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); /* Radial gradient brush. */ @@ -9583,11 +9581,9 @@ static void test_command_list(BOOL d3d11) ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount); refcount = ID2D1Geometry_Release(geometry); - todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); refcount = ID2D1GradientStopCollection_Release(gradient); - todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); /* Geometry. */ @@ -9605,7 +9601,6 @@ static void test_command_list(BOOL d3d11) ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount); refcount = ID2D1Geometry_Release(geometry); - todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); /* Stroke style. */