gdiplus: Reuse point when calling GdipAddPathLine on open figure.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jeff Smith 2020-04-15 15:07:09 -05:00 committed by Alexandre Julliard
parent a7e6cb4a25
commit f54bf06a2a
2 changed files with 10 additions and 19 deletions

View File

@ -717,31 +717,19 @@ GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, I
*/
GpStatus WINGDIPAPI GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2)
{
INT old_count;
PointF points[2];
TRACE("(%p, %.2f, %.2f, %.2f, %.2f)\n", path, x1, y1, x2, y2);
if(!path)
return InvalidParameter;
if(!lengthen_path(path, 2))
return OutOfMemory;
points[0].X = x1;
points[0].Y = y1;
points[1].X = x2;
points[1].Y = y2;
old_count = path->pathdata.Count;
path->pathdata.Points[old_count].X = x1;
path->pathdata.Points[old_count].Y = y1;
path->pathdata.Points[old_count + 1].X = x2;
path->pathdata.Points[old_count + 1].Y = y2;
path->pathdata.Types[old_count] =
(path->newfigure ? PathPointTypeStart : PathPointTypeLine);
path->pathdata.Types[old_count + 1] = PathPointTypeLine;
path->newfigure = FALSE;
path->pathdata.Count += 2;
return Ok;
return extend_current_figure(path, points, 2, PathPointTypeLine);
}
/*************************************************************************

View File

@ -722,7 +722,8 @@ static path_test_t linei_path[] = {
{15.00, 15.00, PathPointTypeLine, 0, 0}, /*9*/
{26.00, 28.00, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*10*/
{35.00, 35.00, PathPointTypeStart, 0, 0}, /*11*/
{36.00, 38.00, PathPointTypeLine, 0, 0} /*12*/
{36.00, 38.00, PathPointTypeLine, 0, 0}, /*12*/
{39.00, 40.00, PathPointTypeLine, 0, 0} /*13*/
};
static void test_linei(void)
@ -739,6 +740,8 @@ static void test_linei(void)
GdipClosePathFigure(path);
status = GdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0);
expect(Ok, status);
status = GdipAddPathLineI(path, 36, 38, 39, 40);
expect(Ok, status);
ok_path(path, linei_path, ARRAY_SIZE(linei_path), FALSE);