Commit edee5538 authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

gdiplus: Add support for LineCapArrowAnchor.

parent 0fd51346
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
#define SQRT3 1.73205080757
typedef struct path_list_node_t path_list_node_t; typedef struct path_list_node_t path_list_node_t;
struct path_list_node_t { struct path_list_node_t {
GpPointF pt; GpPointF pt;
...@@ -1890,6 +1892,7 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint, ...@@ -1890,6 +1892,7 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint,
break; break;
case LineCapSquare: case LineCapSquare:
case LineCapCustom: case LineCapCustom:
case LineCapArrowAnchor:
{ {
REAL segment_dy = nextpoint->Y-endpoint->Y; REAL segment_dy = nextpoint->Y-endpoint->Y;
REAL segment_dx = nextpoint->X-endpoint->X; REAL segment_dx = nextpoint->X-endpoint->X;
...@@ -1909,6 +1912,11 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint, ...@@ -1909,6 +1912,11 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint,
extend_dx = -2.0 * custom_cap->inset * extend_dx; extend_dx = -2.0 * custom_cap->inset * extend_dx;
extend_dy = -2.0 * custom_cap->inset * extend_dy; 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) if (add_first_points)
*last_point = add_path_list_node(*last_point, endpoint->X - extend_dx + bevel_dx, *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, ...@@ -2105,6 +2113,24 @@ static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint,
endpoint->Y + perp_dy, PathPointTypeLine); endpoint->Y + perp_dy, PathPointTypeLine);
break; 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: case LineCapCustom:
{ {
REAL segment_dy = nextpoint->Y - endpoint->Y; REAL segment_dy = nextpoint->Y - endpoint->Y;
...@@ -2416,12 +2442,6 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, ...@@ -2416,12 +2442,6 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
last_point = points; 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) if (pen->dashcap != DashCapFlat)
FIXME("unimplemented dash cap %d\n", pen->dashcap); 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 ...@@ -114,7 +114,7 @@ static void _ok_path_fudge(GpPath* path, const path_test_t *expected, INT expect
stringify_point_type(types[idx], name); stringify_point_type(types[idx], name);
todo_wine_if (expected[eidx].todo || numskip) 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, ename, expected[eidx].X, expected[eidx].Y,
name, points[idx].X, points[idx].Y); name, points[idx].X, points[idx].Y);
...@@ -1655,7 +1655,6 @@ static void test_widen_cap(void) ...@@ -1655,7 +1655,6 @@ static void test_widen_cap(void)
const path_test_t *expected; const path_test_t *expected;
INT expected_size; INT expected_size;
BOOL dashed; BOOL dashed;
BOOL todo_size;
} }
caps[] = caps[] =
{ {
...@@ -1676,7 +1675,7 @@ static void test_widen_cap(void) ...@@ -1676,7 +1675,7 @@ static void test_widen_cap(void)
{ LineCapDiamondAnchor, 10.0, widenline_capdiamondanchor_path, { LineCapDiamondAnchor, 10.0, widenline_capdiamondanchor_path,
ARRAY_SIZE(widenline_capdiamondanchor_path) }, ARRAY_SIZE(widenline_capdiamondanchor_path) },
{ LineCapArrowAnchor, 10.0, widenline_caparrowanchor_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, { LineCapSquareAnchor, 0.0, widenline_capsquareanchor_thin_path,
ARRAY_SIZE(widenline_capsquareanchor_thin_path) }, ARRAY_SIZE(widenline_capsquareanchor_thin_path) },
{ LineCapSquareAnchor, 10.0, widenline_capsquareanchor_dashed_path, { LineCapSquareAnchor, 10.0, widenline_capsquareanchor_dashed_path,
...@@ -1729,7 +1728,7 @@ static void test_widen_cap(void) ...@@ -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); GdipDeletePen(pen);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment