gdiplus: Implement LineCapSquare in GdipWidenPath.

This commit is contained in:
Vincent Povirk 2012-09-20 15:16:58 -05:00 committed by Alexandre Julliard
parent f298b96972
commit 47c433de8c
1 changed files with 27 additions and 2 deletions

View File

@ -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)