winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
596 discussions
Start a n
N
ew thread
Nikolay Sivov : d2d1/commandlist: Implement DrawRectangle() command.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: d1dafde4ed4dedfb6307fc1b562e356eb5974667 URL:
https://gitlab.winehq.org/wine/wine/-/commit/d1dafde4ed4dedfb6307fc1b562e35…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 1 16:51:26 2022 +0300 d2d1/commandlist: Implement DrawRectangle() command. Signed-off-by: Nikolay Sivov <nsivov(a)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; }
1
0
0
0
Nikolay Sivov : d2d1/commandlist: Implement DrawGeometry() command.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: 3ec96c9b80ef198ac0731df0ea45116348b473e0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/3ec96c9b80ef198ac0731df0ea4511…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 1 16:45:32 2022 +0300 d2d1/commandlist: Implement DrawGeometry() command. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/command_list.c | 40 ++++++++++++++++++++++++++++++++++++++++ dlls/d2d1/d2d1_private.h | 3 +++ dlls/d2d1/device.c | 3 ++- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c index 58d6819dc4a..a4b9af02c32 100644 --- a/dlls/d2d1/command_list.c +++ b/dlls/d2d1/command_list.c @@ -30,6 +30,7 @@ enum d2d_command_type D2D_COMMAND_SET_UNIT_MODE, D2D_COMMAND_CLEAR, D2D_COMMAND_DRAW_LINE, + D2D_COMMAND_DRAW_GEOMETRY, D2D_COMMAND_PUSH_CLIP, D2D_COMMAND_POP_CLIP, }; @@ -98,6 +99,15 @@ struct d2d_command_draw_line ID2D1StrokeStyle *stroke_style; }; +struct d2d_command_draw_geometry +{ + struct d2d_command c; + ID2D1Geometry *geometry; + 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); @@ -233,6 +243,13 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface c->stroke_style); break; } + case D2D_COMMAND_DRAW_GEOMETRY: + { + const struct d2d_command_draw_geometry *c = data; + hr = ID2D1CommandSink_DrawGeometry(sink, c->geometry, c->brush, c->stroke_width, + c->stroke_style); + break; + } case D2D_COMMAND_PUSH_CLIP: { const struct d2d_command_push_clip *c = data; @@ -530,3 +547,26 @@ void d2d_command_list_draw_line(struct d2d_command_list *command_list, command->stroke_width = stroke_width; command->stroke_style = stroke_style; } + +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) +{ + struct d2d_command_draw_geometry *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, geometry); + 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_GEOMETRY; + 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 c57306e1a3d..eb09dfa7109 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -749,6 +749,9 @@ void d2d_command_list_clear(struct d2d_command_list *command_list, const D2D1_CO void d2d_command_list_draw_line(struct d2d_command_list *command_list, const struct d2d_device_context *context, D2D1_POINT_2F p0, D2D1_POINT_2F p1, ID2D1Brush *orig_brush, float stroke_width, ID2D1StrokeStyle *stroke_style) DECLSPEC_HIDDEN; +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; 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 cac4ddd9ea5..f2b1b194c95 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -950,7 +950,8 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawGeometry(ID2D1DeviceContext if (context->target.type == D2D_TARGET_COMMAND_LIST) { - FIXME("Unimplemented for command list target.\n"); + d2d_command_list_draw_geometry(context->target.command_list, context, geometry, brush, + stroke_width, stroke_style); return; }
1
0
0
0
Nikolay Sivov : d2d1/commandlist: Implement DrawLine() command.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: ffe196abd9033497562c723c39fd1e5ab020e289 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ffe196abd9033497562c723c39fd1e…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 1 16:37:41 2022 +0300 d2d1/commandlist: Implement DrawLine() command. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/command_list.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/d2d1/d2d1_private.h | 7 +++ dlls/d2d1/device.c | 2 +- dlls/d2d1/tests/d2d1.c | 1 - 4 files changed, 135 insertions(+), 2 deletions(-) diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c index 9b25562aa91..58d6819dc4a 100644 --- a/dlls/d2d1/command_list.c +++ b/dlls/d2d1/command_list.c @@ -29,6 +29,7 @@ enum d2d_command_type D2D_COMMAND_SET_PRIMITIVE_BLEND, D2D_COMMAND_SET_UNIT_MODE, D2D_COMMAND_CLEAR, + D2D_COMMAND_DRAW_LINE, D2D_COMMAND_PUSH_CLIP, D2D_COMMAND_POP_CLIP, }; @@ -88,6 +89,15 @@ struct d2d_command_push_clip D2D1_ANTIALIAS_MODE mode; }; +struct d2d_command_draw_line +{ + struct d2d_command c; + D2D1_POINT_2F p0, p1; + 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); @@ -127,12 +137,16 @@ static ULONG STDMETHODCALLTYPE d2d_command_list_Release(ID2D1CommandList *iface) { struct d2d_command_list *command_list = impl_from_ID2D1CommandList(iface); ULONG refcount = InterlockedDecrement(&command_list->refcount); + size_t i; TRACE("%p decreasing refcount to %lu.\n", iface, refcount); if (!refcount) { ID2D1Factory_Release(command_list->factory); + for (i = 0; i < command_list->objects_count; ++i) + IUnknown_Release(command_list->objects[i]); + free(command_list->objects); free(command_list->data); free(command_list); } @@ -212,6 +226,13 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface hr = ID2D1CommandSink_Clear(sink, &c->color); break; } + case D2D_COMMAND_DRAW_LINE: + { + const struct d2d_command_draw_line *c = data; + hr = ID2D1CommandSink_DrawLine(sink, c->p0, c->p1, c->brush, c->stroke_width, + c->stroke_style); + break; + } case D2D_COMMAND_PUSH_CLIP: { const struct d2d_command_push_clip *c = data; @@ -297,6 +318,88 @@ static void * d2d_command_list_require_space(struct d2d_command_list *command_li return command; } +static void d2d_command_list_reference_object(struct d2d_command_list *command_list, void *object) +{ + IUnknown *obj = object; + + if (!obj) return; + + if (!d2d_array_reserve((void **)&command_list->objects, &command_list->objects_capacity, + command_list->objects_count + 1, sizeof(*command_list->objects))) + { + return; + } + + command_list->objects[command_list->objects_count++] = obj; + IUnknown_AddRef(obj); +} + +static HRESULT d2d_command_list_create_brush(struct d2d_command_list *command_list, + const struct d2d_device_context *ctx, ID2D1Brush *orig_brush, ID2D1Brush **ret) +{ + ID2D1DeviceContext *context = (ID2D1DeviceContext *)&ctx->ID2D1DeviceContext1_iface; + struct d2d_brush *brush = unsafe_impl_from_ID2D1Brush(orig_brush); + D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linear_properties; + D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radial_properties; + D2D1_BITMAP_BRUSH_PROPERTIES1 bitmap_properties; + D2D1_IMAGE_BRUSH_PROPERTIES image_properties; + D2D1_BRUSH_PROPERTIES properties; + HRESULT hr; + + properties.opacity = brush->opacity; + properties.transform = brush->transform; + + switch (brush->type) + { + case D2D_BRUSH_TYPE_SOLID: + hr = ID2D1DeviceContext_CreateSolidColorBrush(context, &brush->u.solid.color, + &properties, (ID2D1SolidColorBrush **)ret); + break; + case D2D_BRUSH_TYPE_LINEAR: + linear_properties.startPoint = brush->u.linear.start; + linear_properties.endPoint = brush->u.linear.end; + hr = ID2D1DeviceContext_CreateLinearGradientBrush(context, &linear_properties, + &properties, &brush->u.linear.gradient->ID2D1GradientStopCollection_iface, + (ID2D1LinearGradientBrush **)ret); + break; + case D2D_BRUSH_TYPE_RADIAL: + radial_properties.center = brush->u.radial.centre; + radial_properties.gradientOriginOffset = brush->u.radial.offset; + radial_properties.radiusX = brush->u.radial.radius.x; + radial_properties.radiusY = brush->u.radial.radius.y; + hr = ID2D1DeviceContext_CreateRadialGradientBrush(context, &radial_properties, + &properties, &brush->u.radial.gradient->ID2D1GradientStopCollection_iface, + (ID2D1RadialGradientBrush **)ret); + break; + case D2D_BRUSH_TYPE_BITMAP: + bitmap_properties.extendModeX = brush->u.bitmap.extend_mode_x; + bitmap_properties.extendModeY = brush->u.bitmap.extend_mode_y; + bitmap_properties.interpolationMode = brush->u.bitmap.interpolation_mode; + hr = ID2D1DeviceContext_CreateBitmapBrush(context, (ID2D1Bitmap *)&brush->u.bitmap.bitmap->ID2D1Bitmap1_iface, + &bitmap_properties, &properties, (ID2D1BitmapBrush1 **)ret); + break; + case D2D_BRUSH_TYPE_IMAGE: + image_properties.sourceRectangle = brush->u.image.source_rect; + image_properties.extendModeX = brush->u.image.extend_mode_x; + image_properties.extendModeY = brush->u.image.extend_mode_y; + image_properties.interpolationMode = brush->u.image.interpolation_mode; + hr = ID2D1DeviceContext_CreateImageBrush(context, brush->u.image.image, + &image_properties, &properties, (ID2D1ImageBrush **)ret); + break; + default: + FIXME("Unsupported brush type %u.\n", brush->type); + return E_UNEXPECTED; + } + + if (SUCCEEDED(hr)) + { + d2d_command_list_reference_object(command_list, *ret); + ID2D1Brush_Release(*ret); + } + + return hr; +} + void d2d_command_list_set_antialias_mode(struct d2d_command_list *command_list, D2D1_ANTIALIAS_MODE mode) { @@ -403,3 +506,27 @@ void d2d_command_list_clear(struct d2d_command_list *command_list, const D2D1_CO if (color) command->color = *color; else memset(&command->color, 0, sizeof(command->color)); } + +void d2d_command_list_draw_line(struct d2d_command_list *command_list, + const struct d2d_device_context *context, D2D1_POINT_2F p0, D2D1_POINT_2F p1, + ID2D1Brush *orig_brush, float stroke_width, ID2D1StrokeStyle *stroke_style) +{ + struct d2d_command_draw_line *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_LINE; + command->p0 = p0; + command->p1 = p1; + 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 fc79feb6e0a..c57306e1a3d 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -724,6 +724,10 @@ struct d2d_command_list size_t size; size_t capacity; void *data; + + size_t objects_count; + size_t objects_capacity; + IUnknown **objects; }; HRESULT d2d_command_list_create(ID2D1Factory *factory, struct d2d_command_list **command_list) DECLSPEC_HIDDEN; @@ -742,6 +746,9 @@ void d2d_command_list_push_clip(struct d2d_command_list *command_list, const D2D D2D1_ANTIALIAS_MODE antialias_mode) DECLSPEC_HIDDEN; void d2d_command_list_pop_clip(struct d2d_command_list *command_list) DECLSPEC_HIDDEN; void d2d_command_list_clear(struct d2d_command_list *command_list, const D2D1_COLOR_F *color) DECLSPEC_HIDDEN; +void d2d_command_list_draw_line(struct d2d_command_list *command_list, const struct d2d_device_context *context, + D2D1_POINT_2F p0, D2D1_POINT_2F p1, 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 39ceb86205f..cac4ddd9ea5 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -576,7 +576,7 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawLine(ID2D1DeviceContext1 *i if (context->target.type == D2D_TARGET_COMMAND_LIST) { - FIXME("Unimplemented for command list target.\n"); + d2d_command_list_draw_line(context->target.command_list, context, p0, p1, brush, stroke_width, stroke_style); return; } diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 7d9af5e0b47..44b762fd0b0 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9632,7 +9632,6 @@ static void test_command_list(BOOL d3d11) ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount); refcount = ID2D1StrokeStyle_Release(stroke_style); - todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); /* Close on attached list. */
1
0
0
0
Nikolay Sivov : d2d1/commandlist: Implement Clear() command.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: ccfdeec3a102cf4937f34acec44b6435d0892755 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ccfdeec3a102cf4937f34acec44b64…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 1 16:11:32 2022 +0300 d2d1/commandlist: Implement Clear() command. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/command_list.c | 23 +++++++++++++++++++++++ dlls/d2d1/d2d1_private.h | 1 + dlls/d2d1/device.c | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c index dba51f24976..9b25562aa91 100644 --- a/dlls/d2d1/command_list.c +++ b/dlls/d2d1/command_list.c @@ -28,6 +28,7 @@ enum d2d_command_type D2D_COMMAND_SET_TRANSFORM, D2D_COMMAND_SET_PRIMITIVE_BLEND, D2D_COMMAND_SET_UNIT_MODE, + D2D_COMMAND_CLEAR, D2D_COMMAND_PUSH_CLIP, D2D_COMMAND_POP_CLIP, }; @@ -74,6 +75,12 @@ struct d2d_command_set_unit_mode D2D1_UNIT_MODE mode; }; +struct d2d_command_clear +{ + struct d2d_command c; + D2D1_COLOR_F color; +}; + struct d2d_command_push_clip { struct d2d_command c; @@ -199,6 +206,12 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface hr = ID2D1CommandSink_SetUnitMode(sink, c->mode); break; } + case D2D_COMMAND_CLEAR: + { + const struct d2d_command_clear *c = data; + hr = ID2D1CommandSink_Clear(sink, &c->color); + break; + } case D2D_COMMAND_PUSH_CLIP: { const struct d2d_command_push_clip *c = data; @@ -380,3 +393,13 @@ void d2d_command_list_pop_clip(struct d2d_command_list *command_list) command = d2d_command_list_require_space(command_list, sizeof(*command)); command->op = D2D_COMMAND_POP_CLIP; } + +void d2d_command_list_clear(struct d2d_command_list *command_list, const D2D1_COLOR_F *color) +{ + struct d2d_command_clear *command; + + command = d2d_command_list_require_space(command_list, sizeof(*command)); + command->c.op = D2D_COMMAND_CLEAR; + if (color) command->color = *color; + else memset(&command->color, 0, sizeof(command->color)); +} diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 7be2d230e76..fc79feb6e0a 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -741,6 +741,7 @@ void d2d_command_list_set_transform(struct d2d_command_list *command_list, void d2d_command_list_push_clip(struct d2d_command_list *command_list, const D2D1_RECT_F *rect, D2D1_ANTIALIAS_MODE antialias_mode) DECLSPEC_HIDDEN; void d2d_command_list_pop_clip(struct d2d_command_list *command_list) DECLSPEC_HIDDEN; +void d2d_command_list_clear(struct d2d_command_list *command_list, const D2D1_COLOR_F *color) 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 79e7b628262..39ceb86205f 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1703,7 +1703,7 @@ static void STDMETHODCALLTYPE d2d_device_context_Clear(ID2D1DeviceContext1 *ifac if (context->target.type == D2D_TARGET_COMMAND_LIST) { - FIXME("Unimplemented for command list target.\n"); + d2d_command_list_clear(context->target.command_list, colour); return; }
1
0
0
0
Nikolay Sivov : d2d1/commandlist: Implement clipping commands recording.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: eba21e7502335f255f31595663f151e6f7bf15d8 URL:
https://gitlab.winehq.org/wine/wine/-/commit/eba21e7502335f255f31595663f151…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 1 16:05:26 2022 +0300 d2d1/commandlist: Implement clipping commands recording. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/command_list.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/d2d1/d2d1_private.h | 3 +++ dlls/d2d1/device.c | 10 ++-------- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c index 796aefc7c58..dba51f24976 100644 --- a/dlls/d2d1/command_list.c +++ b/dlls/d2d1/command_list.c @@ -28,6 +28,8 @@ enum d2d_command_type D2D_COMMAND_SET_TRANSFORM, D2D_COMMAND_SET_PRIMITIVE_BLEND, D2D_COMMAND_SET_UNIT_MODE, + D2D_COMMAND_PUSH_CLIP, + D2D_COMMAND_POP_CLIP, }; struct d2d_command @@ -72,6 +74,13 @@ struct d2d_command_set_unit_mode D2D1_UNIT_MODE mode; }; +struct d2d_command_push_clip +{ + struct d2d_command c; + D2D1_RECT_F rect; + D2D1_ANTIALIAS_MODE mode; +}; + static inline struct d2d_command_list *impl_from_ID2D1CommandList(ID2D1CommandList *iface) { return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface); @@ -190,6 +199,15 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface hr = ID2D1CommandSink_SetUnitMode(sink, c->mode); break; } + case D2D_COMMAND_PUSH_CLIP: + { + const struct d2d_command_push_clip *c = data; + hr = ID2D1CommandSink_PushAxisAlignedClip(sink, &c->rect, c->mode); + break; + } + case D2D_COMMAND_POP_CLIP: + hr = ID2D1CommandSink_PopAxisAlignedClip(sink); + break; default: FIXME("Unhandled command %u.\n", command->op); hr = E_UNEXPECTED; @@ -343,3 +361,22 @@ void d2d_command_list_begin_draw(struct d2d_command_list *command_list, command_list->state = D2D_COMMAND_LIST_STATE_OPEN; } + +void d2d_command_list_push_clip(struct d2d_command_list *command_list, const D2D1_RECT_F *rect, + D2D1_ANTIALIAS_MODE mode) +{ + struct d2d_command_push_clip *command; + + command = d2d_command_list_require_space(command_list, sizeof(*command)); + command->c.op = D2D_COMMAND_PUSH_CLIP; + command->rect = *rect; + command->mode = mode; +} + +void d2d_command_list_pop_clip(struct d2d_command_list *command_list) +{ + struct d2d_command *command; + + command = d2d_command_list_require_space(command_list, sizeof(*command)); + command->op = D2D_COMMAND_POP_CLIP; +} diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index c50d596d550..7be2d230e76 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -738,6 +738,9 @@ void d2d_command_list_set_text_antialias_mode(struct d2d_command_list *command_l void d2d_command_list_set_tags(struct d2d_command_list *command_list, D2D1_TAG tag1, D2D1_TAG tag2) DECLSPEC_HIDDEN; void d2d_command_list_set_transform(struct d2d_command_list *command_list, const D2D1_MATRIX_3X2_F *transform) DECLSPEC_HIDDEN; +void d2d_command_list_push_clip(struct d2d_command_list *command_list, const D2D1_RECT_F *rect, + D2D1_ANTIALIAS_MODE antialias_mode) DECLSPEC_HIDDEN; +void d2d_command_list_pop_clip(struct d2d_command_list *command_list) 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 957c963a97b..79e7b628262 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1653,10 +1653,7 @@ static void STDMETHODCALLTYPE d2d_device_context_PushAxisAlignedClip(ID2D1Device TRACE("iface %p, clip_rect %s, antialias_mode %#x.\n", iface, debug_d2d_rect_f(clip_rect), antialias_mode); if (context->target.type == D2D_TARGET_COMMAND_LIST) - { - FIXME("Unimplemented for command list target.\n"); - return; - } + d2d_command_list_push_clip(context->target.command_list, clip_rect, antialias_mode); if (antialias_mode != D2D1_ANTIALIAS_MODE_ALIASED) FIXME("Ignoring antialias_mode %#x.\n", antialias_mode); @@ -1687,10 +1684,7 @@ static void STDMETHODCALLTYPE d2d_device_context_PopAxisAlignedClip(ID2D1DeviceC TRACE("iface %p.\n", iface); if (context->target.type == D2D_TARGET_COMMAND_LIST) - { - FIXME("Unimplemented for command list target.\n"); - return; - } + d2d_command_list_pop_clip(context->target.command_list); d2d_clip_stack_pop(&context->clip_stack); }
1
0
0
0
Nikolay Sivov : d2d1/commandlist: Implement basic state recording commands.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: 94c51a83f2a6ad1af271efeb4b92967de448f84c URL:
https://gitlab.winehq.org/wine/wine/-/commit/94c51a83f2a6ad1af271efeb4b9296…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 1 15:55:04 2022 +0300 d2d1/commandlist: Implement basic state recording commands. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/command_list.c | 224 ++++++++++++++++++++++++++++++++++++++++++++++- dlls/d2d1/d2d1_private.h | 23 +++++ dlls/d2d1/device.c | 34 ++----- dlls/d2d1/tests/d2d1.c | 2 - 4 files changed, 252 insertions(+), 31 deletions(-)
1
0
0
0
Nikolay Sivov : include: Fix ID2D1CommandSink definition.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: f01852756d8689de9da5818bf9aa8a14ddc1e21a URL:
https://gitlab.winehq.org/wine/wine/-/commit/f01852756d8689de9da5818bf9aa8a…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 1 14:49:58 2022 +0300 include: Fix ID2D1CommandSink definition. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- include/d2d1_1.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index 3dd1530e296..ba3fd24914f 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -575,7 +575,7 @@ interface ID2D1CommandSink : IUnknown [in] IDWriteRenderingParams *text_rendering_params ); HRESULT SetTransform( - [in] D2D1_MATRIX_3X2_F *transform + [in] const D2D1_MATRIX_3X2_F *transform ); HRESULT SetPrimitiveBlend( [in] D2D1_PRIMITIVE_BLEND primitive_blend
1
0
0
0
Nikolay Sivov : d2d1: Allow setting command list as a target.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: fdd6a07a0b3c5aa4f81fa985b876ffcc2922e0b5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/fdd6a07a0b3c5aa4f81fa985b876ff…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Jul 31 12:30:34 2022 +0300 d2d1: Allow setting command list as a target. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/command_list.c | 8 ++ dlls/d2d1/d2d1_private.h | 19 ++- dlls/d2d1/device.c | 310 +++++++++++++++++++++++++++++++++++------------ dlls/d2d1/tests/d2d1.c | 13 +- 4 files changed, 268 insertions(+), 82 deletions(-)
1
0
0
0
Nikolay Sivov : d2d1: Add a command list object stub.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: 753ae1d0a594b0d877f7d3b6bcca374c9ac84295 URL:
https://gitlab.winehq.org/wine/wine/-/commit/753ae1d0a594b0d877f7d3b6bcca37…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Jul 31 00:21:41 2022 +0300 d2d1: Add a command list object stub. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/Makefile.in | 1 + dlls/d2d1/command_list.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/d2d1/d2d1_private.h | 10 ++++ dlls/d2d1/device.c | 11 ++++- dlls/d2d1/tests/d2d1.c | 22 ++++++--- 5 files changed, 154 insertions(+), 9 deletions(-) diff --git a/dlls/d2d1/Makefile.in b/dlls/d2d1/Makefile.in index 4c74839f39a..2bfe57a372d 100644 --- a/dlls/d2d1/Makefile.in +++ b/dlls/d2d1/Makefile.in @@ -7,6 +7,7 @@ C_SRCS = \ bitmap.c \ bitmap_render_target.c \ brush.c \ + command_list.c \ dc_render_target.c \ device.c \ effect.c \ diff --git a/dlls/d2d1/command_list.c b/dlls/d2d1/command_list.c new file mode 100644 index 00000000000..2ee1375df39 --- /dev/null +++ b/dlls/d2d1/command_list.c @@ -0,0 +1,119 @@ +/* + * Copyright 2022 Nikolay Sivov for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "d2d1_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d2d); + +static inline struct d2d_command_list *impl_from_ID2D1CommandList(ID2D1CommandList *iface) +{ + return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface); +} + +static HRESULT STDMETHODCALLTYPE d2d_command_list_QueryInterface(ID2D1CommandList *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_ID2D1CommandList) + || IsEqualGUID(iid, &IID_ID2D1Image) + || IsEqualGUID(iid, &IID_ID2D1Resource) + || IsEqualGUID(iid, &IID_IUnknown)) + { + ID2D1CommandList_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE d2d_command_list_AddRef(ID2D1CommandList *iface) +{ + struct d2d_command_list *command_list = impl_from_ID2D1CommandList(iface); + ULONG refcount = InterlockedIncrement(&command_list->refcount); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG STDMETHODCALLTYPE d2d_command_list_Release(ID2D1CommandList *iface) +{ + struct d2d_command_list *command_list = impl_from_ID2D1CommandList(iface); + ULONG refcount = InterlockedDecrement(&command_list->refcount); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + ID2D1Factory_Release(command_list->factory); + free(command_list); + } + + return refcount; +} + +static void STDMETHODCALLTYPE d2d_command_list_GetFactory(ID2D1CommandList *iface, ID2D1Factory **factory) +{ + struct d2d_command_list *command_list = impl_from_ID2D1CommandList(iface); + + TRACE("iface %p, factory %p.\n", iface, factory); + + ID2D1Factory_AddRef(*factory = command_list->factory); +} + +static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface, ID2D1CommandSink *sink) +{ + FIXME("iface %p, sink %p stub.\n", iface, sink); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE d2d_command_list_Close(ID2D1CommandList *iface) +{ + FIXME("iface %p stub.\n", iface); + + return E_NOTIMPL; +} + +static const ID2D1CommandListVtbl d2d_command_list_vtbl = +{ + d2d_command_list_QueryInterface, + d2d_command_list_AddRef, + d2d_command_list_Release, + d2d_command_list_GetFactory, + d2d_command_list_Stream, + d2d_command_list_Close, +}; + +HRESULT d2d_command_list_create(ID2D1Factory *factory, struct d2d_command_list **command_list) +{ + if (!(*command_list = calloc(1, sizeof(**command_list)))) + return E_OUTOFMEMORY; + + (*command_list)->ID2D1CommandList_iface.lpVtbl = &d2d_command_list_vtbl; + (*command_list)->refcount = 1; + ID2D1Factory_AddRef((*command_list)->factory = factory); + + TRACE("Created command list %p.\n", *command_list); + + return S_OK; +} diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 98f99744746..f949266a399 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -689,6 +689,16 @@ struct d2d_effect_property * d2d_effect_properties_get_property_by_name( const struct d2d_effect_properties *properties, const WCHAR *name) DECLSPEC_HIDDEN; void d2d_effect_properties_cleanup(struct d2d_effect_properties *props) DECLSPEC_HIDDEN; +struct d2d_command_list +{ + ID2D1CommandList ID2D1CommandList_iface; + LONG refcount; + + ID2D1Factory *factory; +}; + +HRESULT d2d_command_list_create(ID2D1Factory *factory, struct d2d_command_list **command_list) DECLSPEC_HIDDEN; + static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) { size_t new_capacity, max_capacity; diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index dc29f3b7cb6..0eae65ab1da 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -2004,9 +2004,16 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateBit static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateCommandList(ID2D1DeviceContext1 *iface, ID2D1CommandList **command_list) { - FIXME("iface %p, command_list %p stub!\n", iface, command_list); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); + struct d2d_command_list *object; + HRESULT hr; - return E_NOTIMPL; + TRACE("iface %p, command_list %p.\n", iface, command_list); + + if (SUCCEEDED(hr = d2d_command_list_create(context->factory, &object))) + *command_list = &object->ID2D1CommandList_iface; + + return hr; } static BOOL STDMETHODCALLTYPE d2d_device_context_IsDxgiFormatSupported(ID2D1DeviceContext1 *iface, DXGI_FORMAT format) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 53e02bbfc30..deb729a78d9 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9469,13 +9469,7 @@ static void test_command_list(BOOL d3d11) device_context = ctx.context; hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - - if (FAILED(hr)) - { - release_test_context(&ctx); - return; - } + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)command_list); ID2D1DeviceContext_BeginDraw(device_context); @@ -9497,6 +9491,7 @@ static void test_command_list(BOOL d3d11) ID2D1RenderTarget_DrawBitmap(rt, bitmap, NULL, 0.25f, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, NULL); refcount = ID2D1Bitmap_Release(bitmap); + todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); /* Solid color brush. */ @@ -9524,6 +9519,7 @@ 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. */ @@ -9547,9 +9543,11 @@ 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. */ @@ -9575,9 +9573,11 @@ 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. */ @@ -9595,6 +9595,7 @@ 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. */ @@ -9621,20 +9622,26 @@ static void test_command_list(BOOL d3d11) ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount); refcount = ID2D1StrokeStyle_Release(stroke_style); + todo_wine ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount); /* Close on attached list. */ ID2D1DeviceContext_GetTarget(device_context, &target); + todo_wine ok(target == (ID2D1Image *)command_list, "Unexpected context target.\n"); ID2D1Image_Release(target); hr = ID2D1CommandList_Close(command_list); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID2D1DeviceContext_GetTarget(device_context, &target); + todo_wine ok(target == NULL, "Unexpected context target.\n"); + if (target) ID2D1Image_Release(target); hr = ID2D1CommandList_Close(command_list); + todo_wine ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr); ID2D1CommandList_Release(command_list); @@ -9644,6 +9651,7 @@ static void test_command_list(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID2D1CommandList_Close(command_list); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID2D1CommandList_Release(command_list);
1
0
0
0
Nikolay Sivov : d2d1/tests: Use test context for command list test.
by Alexandre Julliard
03 Aug '22
03 Aug '22
Module: wine Branch: master Commit: 56b50f158d4f2236614a28c250cddf512568bcea URL:
https://gitlab.winehq.org/wine/wine/-/commit/56b50f158d4f2236614a28c250cddf…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Jul 30 23:36:57 2022 +0300 d2d1/tests: Use test context for command list test. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/tests/d2d1.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 22e020bebb9..53e02bbfc30 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9445,7 +9445,6 @@ static void test_command_list(BOOL d3d11) ID2D1CommandList *command_list; struct d2d1_test_context ctx; ID2D1Geometry *geometry; - ID2D1Factory1 *factory; ID2D1RenderTarget *rt; D2D1_POINT_2F p0, p1; ID2D1Bitmap *bitmap; @@ -9460,23 +9459,20 @@ static void test_command_list(BOOL d3d11) if (!init_test_context(&ctx, d3d11)) return; - if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory))) + if (!ctx.factory1) { - win_skip("ID2D1Factory1 is not supported.\n"); + win_skip("Command lists are not supported.\n"); release_test_context(&ctx); return; } - device_context = create_device_context(factory, ctx.device, d3d11); - ok(device_context != NULL, "Failed to create device context.\n"); + device_context = ctx.context; hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list); todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); if (FAILED(hr)) { - ID2D1DeviceContext_Release(device_context); - ID2D1Factory1_Release(factory); release_test_context(&ctx); return; } @@ -9542,7 +9538,7 @@ static void test_command_list(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f); - hr = ID2D1Factory1_CreateRectangleGeometry(factory, &rect, (ID2D1RectangleGeometry **)&geometry); + hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID2D1RenderTarget_FillGeometry(rt, geometry, brush, NULL); @@ -9570,7 +9566,7 @@ static void test_command_list(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f); - hr = ID2D1Factory1_CreateRectangleGeometry(factory, &rect, (ID2D1RectangleGeometry **)&geometry); + hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID2D1RenderTarget_FillGeometry(rt, geometry, brush, NULL); @@ -9586,7 +9582,7 @@ static void test_command_list(BOOL d3d11) /* Geometry. */ set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f); - hr = ID2D1Factory1_CreateRectangleGeometry(factory, &rect, (ID2D1RectangleGeometry **)&geometry); + hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f); @@ -9610,7 +9606,7 @@ static void test_command_list(BOOL d3d11) stroke_desc.dashStyle = D2D1_DASH_STYLE_DOT; stroke_desc.dashOffset = -1.0f; - hr = ID2D1Factory_CreateStrokeStyle((ID2D1Factory *)factory, &stroke_desc, NULL, 0, &stroke_style); + hr = ID2D1Factory_CreateStrokeStyle((ID2D1Factory *)ctx.factory, &stroke_desc, NULL, 0, &stroke_style); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f); @@ -9653,7 +9649,7 @@ static void test_command_list(BOOL d3d11) ID2D1CommandList_Release(command_list); /* List created with different context. */ - device_context2 = create_device_context(factory, ctx.device, d3d11); + device_context2 = create_device_context(ctx.factory1, ctx.device, d3d11); ok(device_context2 != NULL, "Failed to create device context.\n"); hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list); @@ -9667,8 +9663,6 @@ static void test_command_list(BOOL d3d11) ID2D1DeviceContext_Release(device_context2); ID2D1RenderTarget_Release(rt); - ID2D1DeviceContext_Release(device_context); - ID2D1Factory1_Release(factory); release_test_context(&ctx); }
1
0
0
0
← Newer
1
...
53
54
55
56
57
58
59
60
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Results per page:
10
25
50
100
200