Vincent Povirk : gdiplus: Fix GdipFlattenPath for already-flat paths and add a test.
Alexandre Julliard
julliard at winehq.org
Mon Nov 17 09:14:24 CST 2008
Module: wine
Branch: master
Commit: eddc1275885a8495d8506fffbd5407953e234c0c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=eddc1275885a8495d8506fffbd5407953e234c0c
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Fri Nov 14 16:57:30 2008 -0600
gdiplus: Fix GdipFlattenPath for already-flat paths and add a test.
---
dlls/gdiplus/graphicspath.c | 5 ++---
dlls/gdiplus/tests/graphicspath.c | 13 +++++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 9318e1a..22b27e4 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -984,17 +984,16 @@ GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatnes
/* always add line points and start points */
if((type == PathPointTypeStart) || (type == PathPointTypeLine)){
- type = (path->pathdata.Types[i] & ~PathPointTypeBezier) | PathPointTypeLine;
- if(!add_path_list_node(node, pt.X, pt.Y, type))
+ if(!add_path_list_node(node, pt.X, pt.Y, path->pathdata.Types[i]))
goto memout;
node = node->next;
+ ++i;
continue;
}
/* Bezier curve always stored as 4 points */
if((path->pathdata.Types[i-1] & PathPointTypePathTypeMask) != PathPointTypeStart){
- type = (path->pathdata.Types[i] & ~PathPointTypeBezier) | PathPointTypeLine;
if(!add_path_list_node(node, pt.X, pt.Y, type))
goto memout;
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index 7a5fbc2..168c4b5 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -914,6 +914,11 @@ static path_test_t flattenellipse_path[] = {
{100.0,25.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 1} /*24*/
};
+static path_test_t flattenline_path[] = {
+ {5.0, 10.0,PathPointTypeStart, 0, 0}, /*0*/
+ {50.0, 100.0, PathPointTypeLine, 0, 0} /*1*/
+ };
+
static path_test_t flattenarc_path[] = {
{100.0, 25.0,PathPointTypeStart, 0, 0}, /*0*/
{99.0, 30.0, PathPointTypeLine, 0, 0}, /*1*/
@@ -966,6 +971,14 @@ static void test_flatten(void)
status = GdipResetPath(path);
expect(Ok, status);
+ status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 100.0);
+ expect(Ok, status);
+ status = GdipFlattenPath(path, NULL, 1.0);
+ expect(Ok, status);
+ ok_path(path, flattenline_path, sizeof(flattenline_path)/sizeof(path_test_t), FALSE);
+
+ status = GdipResetPath(path);
+ expect(Ok, status);
status = GdipAddPathArc(path, 0.0, 0.0, 100.0, 50.0, 0.0, 90.0);
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
More information about the wine-cvs
mailing list