Module: wine Branch: master Commit: 6dd11426e0a1083366760e3834a7098ffc0b1b1b URL: https://gitlab.winehq.org/wine/wine/-/commit/6dd11426e0a1083366760e3834a7098...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Tue Jan 24 19:19:16 2023 +0300
d2d1: Scale stroke width for D2D1_STROKE_TRANSFORM_TYPE_FIXED in DrawGeometry::ID2D1DeviceContext1().
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru
---
dlls/d2d1/d2d1_private.h | 1 + dlls/d2d1/device.c | 7 +++++++ dlls/d2d1/stroke.c | 8 ++++++++ 3 files changed, 16 insertions(+)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index f3029bab0f2..1dd5cdb0a39 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -383,6 +383,7 @@ struct d2d_stroke_style
HRESULT d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *factory, const D2D1_STROKE_STYLE_PROPERTIES1 *desc, const float *dashes, UINT32 dash_count); +struct d2d_stroke_style *unsafe_impl_from_ID2D1StrokeStyle(ID2D1StrokeStyle *iface);
struct d2d_layer { diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 33cf943010c..a8993e79d4d 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -942,6 +942,7 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawGeometry(ID2D1DeviceContext const struct d2d_geometry *geometry_impl = unsafe_impl_from_ID2D1Geometry(geometry); struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); struct d2d_brush *brush_impl = unsafe_impl_from_ID2D1Brush(brush); + struct d2d_stroke_style *stroke_style_impl = unsafe_impl_from_ID2D1StrokeStyle(stroke_style);
TRACE("iface %p, geometry %p, brush %p, stroke_width %.8e, stroke_style %p.\n", iface, geometry, brush, stroke_width, stroke_style); @@ -956,6 +957,12 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawGeometry(ID2D1DeviceContext if (stroke_style) FIXME("Ignoring stroke style %p.\n", stroke_style);
+ if (stroke_style_impl) + { + if (stroke_style_impl->desc.transformType == D2D1_STROKE_TRANSFORM_TYPE_FIXED) + stroke_width /= context->drawing_state.transform.m11; + } + d2d_device_context_draw_geometry(context, geometry_impl, brush_impl, stroke_width); }
diff --git a/dlls/d2d1/stroke.c b/dlls/d2d1/stroke.c index 16fa1f60771..fc12d4eb972 100644 --- a/dlls/d2d1/stroke.c +++ b/dlls/d2d1/stroke.c @@ -191,6 +191,14 @@ static const struct ID2D1StrokeStyle1Vtbl d2d_stroke_style_vtbl = d2d_stroke_style_GetStrokeTransformType };
+struct d2d_stroke_style *unsafe_impl_from_ID2D1StrokeStyle(ID2D1StrokeStyle *iface) +{ + if (!iface) + return NULL; + assert((const struct ID2D1StrokeStyle1Vtbl *)iface->lpVtbl == &d2d_stroke_style_vtbl); + return CONTAINING_RECORD(iface, struct d2d_stroke_style, ID2D1StrokeStyle1_iface); +} + HRESULT d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *factory, const D2D1_STROKE_STYLE_PROPERTIES1 *desc, const float *dashes, UINT32 dash_count) {