Module: wine Branch: master Commit: 47c433de8ce9fd894b83a0b96d1963b2ce7ffc16 URL: http://source.winehq.org/git/wine.git/?a=commit;h=47c433de8ce9fd894b83a0b96d...
Author: Vincent Povirk vincent@codeweavers.com Date: Thu Sep 20 15:16:58 2012 -0500
gdiplus: Implement LineCapSquare in GdipWidenPath.
---
dlls/gdiplus/graphicspath.c | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 16f5e2d..0515175 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)