Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/gdiplus/graphicspath.c | 28 ++++++++++++++++++++++++++-- dlls/gdiplus/tests/graphicspath.c | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 79d99a3eb4..249f584089 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -2068,6 +2068,30 @@ static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint,
break; } + case LineCapDiamondAnchor: + { + REAL segment_dy = nextpoint->Y-endpoint->Y; + REAL segment_dx = nextpoint->X-endpoint->X; + REAL segment_length = sqrtf(segment_dy*segment_dy + segment_dx*segment_dx); + REAL par_dx, par_dy; + REAL perp_dx, perp_dy; + + par_dx = -pen->width * segment_dx / segment_length; + par_dy = -pen->width * segment_dy / segment_length; + + perp_dx = -pen->width * segment_dy / segment_length; + perp_dy = pen->width * segment_dx / segment_length; + + *last_point = add_path_list_node(*last_point, endpoint->X + par_dx, + endpoint->Y + par_dy, PathPointTypeStart); + *last_point = add_path_list_node(*last_point, endpoint->X - perp_dx, + endpoint->Y - perp_dy, PathPointTypeLine); + *last_point = add_path_list_node(*last_point, endpoint->X - par_dx, + endpoint->Y - par_dy, PathPointTypeLine); + *last_point = add_path_list_node(*last_point, endpoint->X + perp_dx, + endpoint->Y + perp_dy, PathPointTypeLine); + break; + } }
(*last_point)->type |= PathPointTypeCloseSubpath; @@ -2323,10 +2347,10 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, { last_point = points;
- if (pen->endcap > LineCapRoundAnchor) + if (pen->endcap > LineCapDiamondAnchor) FIXME("unimplemented end cap %x\n", pen->endcap);
- if (pen->startcap > LineCapRoundAnchor) + if (pen->startcap > LineCapDiamondAnchor) FIXME("unimplemented start cap %x\n", pen->startcap);
if (pen->dashcap != DashCapFlat) diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 6acfddd53e..aabacef3aa 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -1389,7 +1389,7 @@ static void test_widen_cap(void) { LineCapRoundAnchor, widenline_caproundanchor_path, ARRAY_SIZE(widenline_caproundanchor_path) }, { LineCapDiamondAnchor, widenline_capdiamondanchor_path, - ARRAY_SIZE(widenline_capdiamondanchor_path), TRUE }, + ARRAY_SIZE(widenline_capdiamondanchor_path) }, { LineCapArrowAnchor, widenline_caparrowanchor_path, ARRAY_SIZE(widenline_caparrowanchor_path), TRUE }, };