Module: wine Branch: master Commit: 0b40c9cb4101fa0891df4b1e6baaba73aeffb1ff URL: http://source.winehq.org/git/wine.git/?a=commit;h=0b40c9cb4101fa0891df4b1e6b...
Author: Vincent Povirk vincent@codeweavers.com Date: Thu Sep 20 16:45:36 2012 -0500
gdiplus: Implement LineCapRound in GdipWidenPath.
---
dlls/gdiplus/graphicspath.c | 47 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 8b3a132..47a864b 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1799,6 +1799,49 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint,
break; } + case LineCapRound: + { + 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 dx, dy, dx2, dy2; + const REAL control_point_distance = 0.5522847498307935; /* 4/3 * (sqrt(2) - 1) */ + + if (add_first_points) + { + dx = -distance * segment_dx / segment_length; + dy = -distance * segment_dy / segment_length; + + dx2 = dx * control_point_distance; + dy2 = dy * control_point_distance; + + /* first 90-degree arc */ + *last_point = add_path_list_node(*last_point, endpoint->X + dy, + endpoint->Y - dx, PathPointTypeLine); + + *last_point = add_path_list_node(*last_point, endpoint->X + dy + dx2, + endpoint->Y - dx + dy2, PathPointTypeBezier); + + *last_point = add_path_list_node(*last_point, endpoint->X + dx + dy2, + endpoint->Y + dy - dx2, PathPointTypeBezier); + + /* midpoint */ + *last_point = add_path_list_node(*last_point, endpoint->X + dx, + endpoint->Y + dy, PathPointTypeBezier); + + /* second 90-degree arc */ + *last_point = add_path_list_node(*last_point, endpoint->X + dx - dy2, + endpoint->Y + dy + dx2, PathPointTypeBezier); + + *last_point = add_path_list_node(*last_point, endpoint->X - dy + dx2, + endpoint->Y + dx + dy2, PathPointTypeBezier); + + *last_point = add_path_list_node(*last_point, endpoint->X - dy, + endpoint->Y + dx, PathPointTypeBezier); + } + break; + } } }
@@ -1905,10 +1948,10 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, { last_point = points;
- if (pen->endcap > LineCapSquare) + if (pen->endcap > LineCapRound) FIXME("unimplemented end cap %x\n", pen->endcap);
- if (pen->startcap > LineCapSquare) + if (pen->startcap > LineCapRound) FIXME("unimplemented start cap %x\n", pen->startcap);
if (pen->dashcap != DashCapFlat)