Nikolay Sivov : d2d1/commandlist: Implement DrawRectangle() command.
Alexandre Julliard
julliard at winehq.org
Wed Aug 3 15:30:39 CDT 2022
Module: wine
Branch: master
Commit: d1dafde4ed4dedfb6307fc1b562e356eb5974667
URL: https://gitlab.winehq.org/wine/wine/-/commit/d1dafde4ed4dedfb6307fc1b562e356eb5974667
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Aug 1 16:51:26 2022 +0300
d2d1/commandlist: Implement DrawRectangle() command.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/d2d1/command_list.c | 39 +++++++++++++++++++++++++++++++++++++++
dlls/d2d1/d2d1_private.h | 2 ++
dlls/d2d1/device.c | 2 +-
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c
index a4b9af02c32..e4b71ce0108 100644
--- a/dlls/d2d1/command_list.c
+++ b/dlls/d2d1/command_list.c
@@ -31,6 +31,7 @@ enum d2d_command_type
D2D_COMMAND_CLEAR,
D2D_COMMAND_DRAW_LINE,
D2D_COMMAND_DRAW_GEOMETRY,
+ D2D_COMMAND_DRAW_RECTANGLE,
D2D_COMMAND_PUSH_CLIP,
D2D_COMMAND_POP_CLIP,
};
@@ -108,6 +109,15 @@ struct d2d_command_draw_geometry
ID2D1StrokeStyle *stroke_style;
};
+struct d2d_command_draw_rectangle
+{
+ struct d2d_command c;
+ D2D1_RECT_F rect;
+ ID2D1Brush *brush;
+ float stroke_width;
+ ID2D1StrokeStyle *stroke_style;
+};
+
static inline struct d2d_command_list *impl_from_ID2D1CommandList(ID2D1CommandList *iface)
{
return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface);
@@ -250,6 +260,13 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface
c->stroke_style);
break;
}
+ case D2D_COMMAND_DRAW_RECTANGLE:
+ {
+ const struct d2d_command_draw_rectangle *c = data;
+ hr = ID2D1CommandSink_DrawRectangle(sink, &c->rect, c->brush, c->stroke_width,
+ c->stroke_style);
+ break;
+ }
case D2D_COMMAND_PUSH_CLIP:
{
const struct d2d_command_push_clip *c = data;
@@ -570,3 +587,25 @@ void d2d_command_list_draw_geometry(struct d2d_command_list *command_list,
command->stroke_width = stroke_width;
command->stroke_style = stroke_style;
}
+
+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)
+{
+ struct d2d_command_draw_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;
+ }
+
+ d2d_command_list_reference_object(command_list, stroke_style);
+
+ command = d2d_command_list_require_space(command_list, sizeof(*command));
+ command->c.op = D2D_COMMAND_DRAW_RECTANGLE;
+ command->rect = *rect;
+ command->brush = brush;
+ command->stroke_width = stroke_width;
+ command->stroke_style = stroke_style;
+}
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index eb09dfa7109..4e39ff39960 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -752,6 +752,8 @@ void d2d_command_list_draw_line(struct d2d_command_list *command_list, const str
void d2d_command_list_draw_geometry(struct d2d_command_list *command_list,
const struct d2d_device_context *context, ID2D1Geometry *geometry, ID2D1Brush *orig_brush,
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;
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 f2b1b194c95..13321fa04c6 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -616,7 +616,7 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawRectangle(ID2D1DeviceContex
if (context->target.type == D2D_TARGET_COMMAND_LIST)
{
- FIXME("Unimplemented for command list target.\n");
+ d2d_command_list_draw_rectangle(context->target.command_list, context, rect, brush, stroke_width, stroke_style);
return;
}
More information about the wine-cvs
mailing list