Nikolay Sivov : d2d1/commandlist: Implement FillRectangle() command.
Alexandre Julliard
julliard at winehq.org
Wed Aug 3 15:30:40 CDT 2022
Module: wine
Branch: master
Commit: 0e9f8babaff534e2736541354dc65d889ca1c9a7
URL: https://gitlab.winehq.org/wine/wine/-/commit/0e9f8babaff534e2736541354dc65d889ca1c9a7
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Aug 1 17:10:59 2022 +0300
d2d1/commandlist: Implement FillRectangle() command.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/d2d1/command_list.c | 32 ++++++++++++++++++++++++++++++++
dlls/d2d1/d2d1_private.h | 2 ++
dlls/d2d1/device.c | 2 +-
dlls/d2d1/tests/d2d1.c | 1 -
4 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c
index 9399c3e528d..6cc46aa2c32 100644
--- a/dlls/d2d1/command_list.c
+++ b/dlls/d2d1/command_list.c
@@ -33,6 +33,7 @@ enum d2d_command_type
D2D_COMMAND_DRAW_GEOMETRY,
D2D_COMMAND_DRAW_RECTANGLE,
D2D_COMMAND_FILL_GEOMETRY,
+ D2D_COMMAND_FILL_RECTANGLE,
D2D_COMMAND_PUSH_CLIP,
D2D_COMMAND_POP_CLIP,
};
@@ -127,6 +128,13 @@ struct d2d_command_fill_geometry
ID2D1Brush *opacity_brush;
};
+struct d2d_command_fill_rectangle
+{
+ struct d2d_command c;
+ D2D1_RECT_F rect;
+ ID2D1Brush *brush;
+};
+
static inline struct d2d_command_list *impl_from_ID2D1CommandList(ID2D1CommandList *iface)
{
return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface);
@@ -282,6 +290,12 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface
hr = ID2D1CommandSink_FillGeometry(sink, c->geometry, c->brush, c->opacity_brush);
break;
}
+ case D2D_COMMAND_FILL_RECTANGLE:
+ {
+ const struct d2d_command_fill_rectangle *c = data;
+ hr = ID2D1CommandSink_FillRectangle(sink, &c->rect, c->brush);
+ break;
+ }
case D2D_COMMAND_PUSH_CLIP:
{
const struct d2d_command_push_clip *c = data;
@@ -654,3 +668,21 @@ void d2d_command_list_fill_geometry(struct d2d_command_list *command_list,
command->brush = brush;
command->opacity_brush = opacity_brush;
}
+
+void d2d_command_list_fill_rectangle(struct d2d_command_list *command_list,
+ const struct d2d_device_context *context, const D2D1_RECT_F *rect, ID2D1Brush *orig_brush)
+{
+ struct d2d_command_fill_rectangle *command;
+ ID2D1Brush *brush;
+
+ if (FAILED(d2d_command_list_create_brush(command_list, context, orig_brush, &brush)))
+ {
+ command_list->state = D2D_COMMAND_LIST_STATE_ERROR;
+ return;
+ }
+
+ command = d2d_command_list_require_space(command_list, sizeof(*command));
+ command->c.op = D2D_COMMAND_FILL_RECTANGLE;
+ command->rect = *rect;
+ command->brush = brush;
+}
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 0651e83d9d1..9d0883468b2 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -757,6 +757,8 @@ void d2d_command_list_draw_rectangle(struct d2d_command_list *command_list, cons
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;
+void d2d_command_list_fill_rectangle(struct d2d_command_list *command_list,
+ const struct d2d_device_context *context, const D2D1_RECT_F *rect, ID2D1Brush *orig_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 8e9b236e2af..cb997624e0a 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -641,7 +641,7 @@ static void STDMETHODCALLTYPE d2d_device_context_FillRectangle(ID2D1DeviceContex
if (context->target.type == D2D_TARGET_COMMAND_LIST)
{
- FIXME("Unimplemented for command list target.\n");
+ d2d_command_list_fill_rectangle(context->target.command_list, context, rect, brush);
return;
}
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 3137d5c13c2..f66f3389d3c 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -9529,7 +9529,6 @@ static void test_command_list(BOOL d3d11)
ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
refcount = ID2D1Bitmap_Release(bitmap);
- todo_wine
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
/* Linear gradient brush. */
More information about the wine-cvs
mailing list