From 065806e5f169662ff6bdc0fe842d702bf6065e43 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Fri, 10 Nov 2006 12:50:34 +0000 Subject: [PATCH] Sync up PATH_Arc and PATH_Ellipse with Wine. svn path=/trunk/; revision=24713 --- .../subsystems/win32/win32k/include/path.h | 2 +- .../subsystems/win32/win32k/objects/line.c | 2 +- .../subsystems/win32/win32k/objects/path.c | 24 ++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/path.h b/reactos/subsystems/win32/win32k/include/path.h index 3ba47d2d556..d489340b967 100644 --- a/reactos/subsystems/win32/win32k/include/path.h +++ b/reactos/subsystems/win32/win32k/include/path.h @@ -3,7 +3,7 @@ #define PATH_IsPathOpen(path) ((path).state==PATH_Open) -BOOL FASTCALL PATH_Arc (PDC dc, INT x1, INT y1, INT x2, INT y2, INT xStart, INT yStart, INT xEnd, INT yEnd); +BOOL FASTCALL PATH_Arc (PDC dc, INT x1, INT y1, INT x2, INT y2, INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines); BOOL FASTCALL PATH_AssignGdiPath (GdiPath *pPathDest, const GdiPath *pPathSrc); VOID FASTCALL PATH_DestroyGdiPath (GdiPath *pPath); BOOL FASTCALL PATH_Ellipse (PDC dc, INT x1, INT y1, INT x2, INT y2); diff --git a/reactos/subsystems/win32/win32k/objects/line.c b/reactos/subsystems/win32/win32k/objects/line.c index e2288a8457f..9773e95a831 100644 --- a/reactos/subsystems/win32/win32k/objects/line.c +++ b/reactos/subsystems/win32/win32k/objects/line.c @@ -299,7 +299,7 @@ IntGdiArc(DC *dc, if(PATH_IsPathOpen(dc->w.path)) { return PATH_Arc(dc, LeftRect, TopRect, RightRect, BottomRect, - XStartArc, YStartArc, XEndArc, YEndArc); + XStartArc, YStartArc, XEndArc, YEndArc, GdiTypeArc ); } // FIXME diff --git a/reactos/subsystems/win32/win32k/objects/path.c b/reactos/subsystems/win32/win32k/objects/path.c index 91862d5f3d5..c2455336975 100644 --- a/reactos/subsystems/win32/win32k/objects/path.c +++ b/reactos/subsystems/win32/win32k/objects/path.c @@ -720,24 +720,29 @@ PATH_Ellipse ( PDC dc, INT x1, INT y1, INT x2, INT y2 ) { /* TODO: This should probably be revised to call PATH_AngleArc */ /* (once it exists) */ - return PATH_Arc ( dc, x1, y1, x2, y2, x1, (y1+y2)/2, x1, (y1+y2)/2 ); + BOOL Ret = PATH_Arc ( dc, x1, y1, x2, y2, x1, (y1+y2)/2, x1, (y1+y2)/2, GdiTypeArc ); + if (Ret) IntGdiCloseFigure(dc); + return Ret; } /* PATH_Arc * * Should be called when a call to Arc is performed on a DC that has * an open path. This adds up to five Bezier splines representing the arc - * to the path. Returns TRUE if successful, else FALSE. + * to the path. When 'lines' is 1, we add 1 extra line to get a chord, + * and when 'lines' is 2, we add 2 extra lines to get a pie. + * Returns TRUE if successful, else FALSE. */ BOOL FASTCALL PATH_Arc ( PDC dc, INT x1, INT y1, INT x2, INT y2, - INT xStart, INT yStart, INT xEnd, INT yEnd) + INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines) { double angleStart, angleEnd, angleStartQuadrant, angleEndQuadrant=0.0; /* Initialize angleEndQuadrant to silence gcc's warning */ double x, y; FLOAT_POINT corners[2], pointStart, pointEnd; + POINT centre; BOOL start, end; INT temp; BOOL clockwise; @@ -858,6 +863,19 @@ PATH_Arc ( PDC dc, INT x1, INT y1, INT x2, INT y2, start = FALSE; } while(!end); + /* chord: close figure. pie: add line and close figure */ + if(lines==GdiTypeChord) // 1 + { + IntGdiCloseFigure(dc); + } + else if(lines==GdiTypePie) // 2 + { + centre.x = (corners[0].x+corners[1].x)/2; + centre.y = (corners[0].y+corners[1].y)/2; + if(!PATH_AddEntry(&dc->w.path, ¢re, PT_LINETO | PT_CLOSEFIGURE)) + return FALSE; + } + return TRUE; }