mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 09:55:50 +00:00
gdiplus: Add support for LineCapArrowAnchor.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42809
This commit is contained in:
parent
0fd51346e1
commit
edee5538e3
|
@ -33,6 +33,8 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
|
||||
|
||||
#define SQRT3 1.73205080757
|
||||
|
||||
typedef struct path_list_node_t path_list_node_t;
|
||||
struct path_list_node_t {
|
||||
GpPointF pt;
|
||||
|
@ -1890,6 +1892,7 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint,
|
|||
break;
|
||||
case LineCapSquare:
|
||||
case LineCapCustom:
|
||||
case LineCapArrowAnchor:
|
||||
{
|
||||
REAL segment_dy = nextpoint->Y-endpoint->Y;
|
||||
REAL segment_dx = nextpoint->X-endpoint->X;
|
||||
|
@ -1909,6 +1912,11 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint,
|
|||
extend_dx = -2.0 * custom_cap->inset * extend_dx;
|
||||
extend_dy = -2.0 * custom_cap->inset * extend_dy;
|
||||
}
|
||||
else if (cap == LineCapArrowAnchor)
|
||||
{
|
||||
extend_dx = -3.0 * extend_dx;
|
||||
extend_dy = -3.0 * extend_dy;
|
||||
}
|
||||
|
||||
if (add_first_points)
|
||||
*last_point = add_path_list_node(*last_point, endpoint->X - extend_dx + bevel_dx,
|
||||
|
@ -2105,6 +2113,24 @@ static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint,
|
|||
endpoint->Y + perp_dy, PathPointTypeLine);
|
||||
break;
|
||||
}
|
||||
case LineCapArrowAnchor:
|
||||
{
|
||||
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 = pen_width * segment_dx / segment_length;
|
||||
REAL par_dy = pen_width * segment_dy / segment_length;
|
||||
REAL perp_dx = -par_dy;
|
||||
REAL perp_dy = par_dx;
|
||||
|
||||
*last_point = add_path_list_node(*last_point, endpoint->X,
|
||||
endpoint->Y, PathPointTypeStart);
|
||||
*last_point = add_path_list_node(*last_point, endpoint->X + SQRT3 * par_dx - perp_dx,
|
||||
endpoint->Y + SQRT3 * par_dy - perp_dy, PathPointTypeLine);
|
||||
*last_point = add_path_list_node(*last_point, endpoint->X + SQRT3 * par_dx + perp_dx,
|
||||
endpoint->Y + SQRT3 * par_dy + perp_dy, PathPointTypeLine);
|
||||
break;
|
||||
}
|
||||
case LineCapCustom:
|
||||
{
|
||||
REAL segment_dy = nextpoint->Y - endpoint->Y;
|
||||
|
@ -2416,12 +2442,6 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
|
|||
|
||||
last_point = points;
|
||||
|
||||
if (pen->endcap > LineCapDiamondAnchor && pen->endcap != LineCapCustom)
|
||||
FIXME("unimplemented end cap %x\n", pen->endcap);
|
||||
|
||||
if (pen->startcap > LineCapDiamondAnchor && pen->startcap != LineCapCustom)
|
||||
FIXME("unimplemented start cap %x\n", pen->startcap);
|
||||
|
||||
if (pen->dashcap != DashCapFlat)
|
||||
FIXME("unimplemented dash cap %d\n", pen->dashcap);
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ static void _ok_path_fudge(GpPath* path, const path_test_t *expected, INT expect
|
|||
stringify_point_type(types[idx], name);
|
||||
|
||||
todo_wine_if (expected[eidx].todo || numskip)
|
||||
ok_(__FILE__,line)(match, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx,
|
||||
ok_(__FILE__,line)(match, "Expected #%d: %s (%.6f,%.6f) but got %s (%.6f,%.6f)\n", eidx,
|
||||
ename, expected[eidx].X, expected[eidx].Y,
|
||||
name, points[idx].X, points[idx].Y);
|
||||
|
||||
|
@ -1655,7 +1655,6 @@ static void test_widen_cap(void)
|
|||
const path_test_t *expected;
|
||||
INT expected_size;
|
||||
BOOL dashed;
|
||||
BOOL todo_size;
|
||||
}
|
||||
caps[] =
|
||||
{
|
||||
|
@ -1676,7 +1675,7 @@ static void test_widen_cap(void)
|
|||
{ LineCapDiamondAnchor, 10.0, widenline_capdiamondanchor_path,
|
||||
ARRAY_SIZE(widenline_capdiamondanchor_path) },
|
||||
{ LineCapArrowAnchor, 10.0, widenline_caparrowanchor_path,
|
||||
ARRAY_SIZE(widenline_caparrowanchor_path), FALSE, TRUE },
|
||||
ARRAY_SIZE(widenline_caparrowanchor_path) },
|
||||
{ LineCapSquareAnchor, 0.0, widenline_capsquareanchor_thin_path,
|
||||
ARRAY_SIZE(widenline_capsquareanchor_thin_path) },
|
||||
{ LineCapSquareAnchor, 10.0, widenline_capsquareanchor_dashed_path,
|
||||
|
@ -1729,7 +1728,7 @@ static void test_widen_cap(void)
|
|||
}
|
||||
}
|
||||
|
||||
ok_path_fudge(path, caps[i].expected, caps[i].expected_size, caps[i].todo_size, 0.000005);
|
||||
ok_path_fudge(path, caps[i].expected, caps[i].expected_size, FALSE, 0.000005);
|
||||
|
||||
GdipDeletePen(pen);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue