Laurent Vromman : gdi32:
Correction of WidenPath behaviour when pen width is 1.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Apr 3 06:48:35 CDT 2007
Module: wine
Branch: master
Commit: 525fd823665dc896b7c8efe625c2a472e9154eed
URL: http://source.winehq.org/git/wine.git/?a=commit;h=525fd823665dc896b7c8efe625c2a472e9154eed
Author: Laurent Vromman <laurent at vromman.org>
Date: Mon Apr 2 23:33:09 2007 +0200
gdi32: Correction of WidenPath behaviour when pen width is 1.
---
dlls/gdi32/path.c | 5 +++++
dlls/gdi32/tests/path.c | 16 +++++++++++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index af756b3..c3b1f1c 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -1795,6 +1795,11 @@ static BOOL PATH_WidenPath(DC *dc)
penWidth = elp->elpWidth;
HeapFree( GetProcessHeap(), 0, elp );
+ /* pen width must be strictly higher than 1 */
+ if(penWidth == 1) {
+ return TRUE;
+ }
+
/* FIXME : If extPen, use the shape on corners */
penWidthIn = penWidth / 2;
penWidthOut = penWidth / 2;
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index 0346b28..074a151 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
+#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
@@ -31,7 +32,7 @@
static void test_widenpath(void)
{
HDC hdc = GetDC(0);
- HPEN greenPen;
+ HPEN greenPen, narrowPen;
HPEN oldPen;
POINT pnt[6];
INT nSize;
@@ -67,6 +68,8 @@ static void test_widenpath(void)
ok(nSize != -1, "GetPath fails after calling WidenPath.\n");
ok(nSize > 6, "Path number of points is to low. Should be more than 6 but is %d\n", nSize);
+ AbortPath(hdc);
+
todo_wine {
/* Test WidenPath with an empty path */
SetLastError(0xdeadbeef);
@@ -74,6 +77,17 @@ static void test_widenpath(void)
ok(WidenPath(hdc) == FALSE, "WidenPath fails while widening an empty path. Error : %d\n", GetLastError());
}
+ AbortPath(hdc);
+
+ /* Test when the pen width is equal to 1. The path should not change */
+ narrowPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
+ oldPen = SelectObject(hdc, narrowPen);
+ BeginPath(hdc);
+ Polyline(hdc, pnt, 6);
+ EndPath(hdc);
+ nSize = GetPath(hdc, NULL, NULL, 0);
+ ok(nSize == 6, "WidenPath fails detecting 1px wide pen. Path length is %d, should be 6\n", nSize);
+
ReleaseDC(0, hdc);
return;
}
More information about the wine-cvs
mailing list