[2/2] gdi32: fixed PolyDraw [try5]
Evan Stade
estade at gmail.com
Thu Jul 5 21:09:41 CDT 2007
Hi,
changelog:
* added PATH_PolyDraw in path.c
* removed todo_wine on some conformance tests
dlls/gdi32/gdi_private.h | 1 +
dlls/gdi32/painting.c | 5 +++
dlls/gdi32/path.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/gdi32/tests/path.c | 14 +++++----
4 files changed, 82 insertions(+), 7 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index c6810dd..473cf86 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -481,6 +481,7 @@ extern BOOL PATH_Arc(DC *dc, INT x1, INT
INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines);
extern BOOL PATH_PolyBezierTo(DC *dc, const POINT *pt, DWORD cbCount);
extern BOOL PATH_PolyBezier(DC *dc, const POINT *pt, DWORD cbCount);
+extern BOOL PATH_PolyDraw(DC *dc, const POINT *pt, const BYTE *tp, DWORD cbCount);
extern BOOL PATH_PolylineTo(DC *dc, const POINT *pt, DWORD cbCount);
extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount);
extern BOOL PATH_Polygon(DC *dc, const POINT *pt, DWORD cbCount);
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 4a8b8c9..904c848 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -835,6 +835,11 @@ BOOL WINAPI PolyDraw(HDC hdc, const POIN
result = dc->funcs->pPolyDraw( dc->physDev, lppt, lpbTypes, cCount );
goto end;
}
+ if( PATH_IsPathOpen( dc->path ) )
+ {
+ result = PATH_PolyDraw(dc, lppt, lpbTypes, cCount);
+ goto end;
+ }
/* check for each bezierto if there are two more points */
for( i = 0; i < cCount; i++ )
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 1a37adc..f000a25 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -933,6 +933,75 @@ BOOL PATH_PolyBezier(DC *dc, const POINT
return TRUE;
}
+/* PATH_PolyDraw
+ *
+ * Should be called when a call to PolyDraw is performed on a DC that has
+ * an open path. Returns TRUE if successful, else FALSE.
+ */
+BOOL PATH_PolyDraw(DC *dc, const POINT *pts, const BYTE *types,
+ DWORD cbPoints)
+{
+ GdiPath *pPath = &dc->path;
+ POINT lastmove, orig_pos;
+ INT i;
+
+ lastmove.x = orig_pos.x = dc->CursPosX;
+ lastmove.y = orig_pos.y = dc->CursPosY;
+
+ for( i = pPath->numEntriesUsed-1; i >= 0; i-- ){
+ if(pPath->pFlags[i] == PT_MOVETO){
+ lastmove.x = pPath->pPoints[i].x;
+ lastmove.y = pPath->pPoints[i].y;
+ if(!DPtoLP(dc->hSelf, &lastmove, 1))
+ return FALSE;
+ break;
+ }
+ }
+
+ for( i = 0; i < cbPoints; i++ ){
+ if(types[i] == PT_MOVETO){
+ pPath->newStroke = TRUE;
+ lastmove.x = pts[i].x;
+ lastmove.y = pts[i].y;
+ }
+ else if((types[i] & ~PT_CLOSEFIGURE) == PT_LINETO){
+ PATH_LineTo(dc, pts[i].x, pts[i].y);
+ }
+ else if(types[i] == PT_BEZIERTO){
+ if(!((i + 2 < cbPoints) && (types[i + 1] == PT_BEZIERTO)
+ && ((types[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO))){
+ goto err;
+ }
+ PATH_PolyBezierTo(dc, &(pts[i]), 3);
+ i += 2;
+ }
+ else{
+ goto err;
+ }
+
+ dc->CursPosX = pts[i].x;
+ dc->CursPosY = pts[i].y;
+
+ if(types[i] & PT_CLOSEFIGURE){
+ pPath->pFlags[pPath->numEntriesUsed-1] |= PT_CLOSEFIGURE;
+ pPath->newStroke = TRUE;
+ dc->CursPosX = lastmove.x;
+ dc->CursPosY = lastmove.y;
+ }
+ }
+
+ return TRUE;
+
+err:
+ if((dc->CursPosX != orig_pos.x) || (dc->CursPosY != orig_pos.y)){
+ pPath->newStroke = TRUE;
+ dc->CursPosX = orig_pos.x;
+ dc->CursPosY = orig_pos.y;
+ }
+
+ return FALSE;
+}
+
BOOL PATH_Polyline(DC *dc, const POINT *pts, DWORD cbPoints)
{
GdiPath *pPath = &dc->path;
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index 8e389f3..b0b330d 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -301,12 +301,12 @@ static const path_test_t polydraw_path[]
{95, 95, 2, 0, 0}, /*4*/
{10, 10, 2, 0, 0}, /*5*/
{10, 15, 3, 0, 0}, /*6*/
- {100, 100, 6, 0, 1}, /*7*/
- {15, 15, 2, 0, 1}, /*8*/
- {100, 100, 6, 0, 1}, /*9*/
- {30, 30, 4, 0, 1}, /*10*/
- {30, 35, 4, 0, 1}, /*11*/
- {35, 35, 4, 0, 1}, /*12*/
+ {100, 100, 6, 0, 0}, /*7*/
+ {15, 15, 2, 0, 0}, /*8*/
+ {100, 100, 6, 0, 0}, /*9*/
+ {30, 30, 4, 0, 0}, /*10*/
+ {30, 35, 4, 0, 0}, /*11*/
+ {35, 35, 4, 0, 0}, /*12*/
{45, 50, 2, 0, 0}, /*13*/
{35, 35, 6, 0, 0}, /*14*/
{50, 55, 2, 0, 0}, /*15*/
@@ -368,7 +368,7 @@ static void test_polydraw(void)
EndPath(hdc);
- ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t), 1);
+ ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t), 0);
done:
ReleaseDC(0, hdc);
}
--
1.4.1
More information about the wine-patches
mailing list