Commit 9164cf8f authored by David Kahurani's avatar David Kahurani Committed by Alexandre Julliard

gdiplus: Use path_list to path helper in GdipWidenPath.

The data is the path is invalid and therefore caution has to be taken when adding data to this path to avoid lengthening it unnecessarily. Also, don't assume there's a head node on the list while counting number of nodes. Signed-off-by: 's avatarDavid Kahurani <k.kahurani@gmail.com>
parent ccc35685
......@@ -95,10 +95,13 @@ static path_list_node_t* add_path_list_node(path_list_node_t *node, REAL x, REAL
/* returns element count */
static INT path_list_count(path_list_node_t *node)
{
INT count = 1;
INT count = 0;
while((node = node->next))
while(node)
{
++count;
node = node->next;
}
return count;
}
......@@ -2501,7 +2504,7 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
GpPath *flat_path=NULL;
GpStatus status;
path_list_node_t *points=NULL, *last_point=NULL;
int i, subpath_start=0, new_length;
int i, subpath_start=0;
TRACE("(%p,%p,%s,%0.2f)\n", path, pen, debugstr_matrix(matrix), flatness);
......@@ -2584,23 +2587,8 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
}
}
new_length = path_list_count(points)-1;
if (!lengthen_path(path, new_length))
if (!path_list_to_path(points->next, path))
status = OutOfMemory;
}
if (status == Ok)
{
path->pathdata.Count = new_length;
last_point = points->next;
for (i = 0; i < new_length; i++)
{
path->pathdata.Points[i] = last_point->pt;
path->pathdata.Types[i] = last_point->type;
last_point = last_point->next;
}
path->fill = FillModeWinding;
}
......
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