From 47c433de8ce9fd894b83a0b96d1963b2ce7ffc16 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 20 Sep 2012 15:16:58 -0500 Subject: [PATCH] gdiplus: Implement LineCapSquare in GdipWidenPath. --- dlls/gdiplus/graphicspath.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 16f5e2dd069..05151755ab9 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1774,6 +1774,31 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint, if (add_last_point) add_bevel_point(endpoint, nextpoint, pen, 0, last_point); break; + case LineCapSquare: + { + 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 distance = pen->width/2.0; + REAL bevel_dx, bevel_dy; + REAL extend_dx, extend_dy; + + extend_dx = -distance * segment_dx / segment_length; + extend_dy = -distance * segment_dy / segment_length; + + bevel_dx = -distance * segment_dy / segment_length; + bevel_dy = distance * segment_dx / segment_length; + + if (add_first_points) + *last_point = add_path_list_node(*last_point, endpoint->X + extend_dx + bevel_dx, + endpoint->Y + extend_dy + bevel_dy, PathPointTypeLine); + + if (add_last_point) + *last_point = add_path_list_node(*last_point, endpoint->X + extend_dx - bevel_dx, + endpoint->Y + extend_dy - bevel_dy, PathPointTypeLine); + + break; + } } } @@ -1878,10 +1903,10 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, { last_point = points; - if (pen->endcap != LineCapFlat) + if (pen->endcap > LineCapSquare) FIXME("unimplemented end cap %x\n", pen->endcap); - if (pen->startcap != LineCapFlat) + if (pen->startcap > LineCapSquare) FIXME("unimplemented start cap %x\n", pen->startcap); if (pen->dashcap != DashCapFlat) -- 2.11.4.GIT