gdi32: Handle ArcTo in paths as native.

This commit is contained in:
Misha Koshelev 2007-06-20 17:02:58 -05:00 committed by Alexandre Julliard
parent e04aebd654
commit 859bf44c33
3 changed files with 24 additions and 8 deletions

View File

@ -124,7 +124,9 @@ BOOL WINAPI ArcTo( HDC hdc,
DC * dc = DC_GetDCUpdate( hdc );
if(!dc) return FALSE;
if(dc->funcs->pArcTo)
if(PATH_IsPathOpen(dc->path))
result = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,-1);
else if(dc->funcs->pArcTo)
result = dc->funcs->pArcTo( dc->physDev, left, top, right, bottom,
xstart, ystart, xend, yend );
else /* We'll draw a line from the current position to the starting point of the arc, then draw the arc */

View File

@ -725,8 +725,10 @@ BOOL PATH_Ellipse(DC *dc, INT x1, INT y1, INT x2, INT y2)
* 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. 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.
* when 'lines' is 2, we add 2 extra lines to get a pie, and when 'lines' is
* -1 we add 1 extra line from the current DC position to the starting position
* of the arc before drawing the arc itself (arcto). Returns TRUE if successful,
* else FALSE.
*/
BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines)
@ -736,7 +738,7 @@ BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
/* Initialize angleEndQuadrant to silence gcc's warning */
double x, y;
FLOAT_POINT corners[2], pointStart, pointEnd;
POINT centre;
POINT centre, pointCurPos;
BOOL start, end;
INT temp;
@ -811,6 +813,18 @@ BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
corners[1].y--;
}
/* arcto: Add a PT_MOVETO only if this is the first entry in a stroke */
if(lines==-1 && pPath->newStroke)
{
pPath->newStroke=FALSE;
pointCurPos.x = dc->CursPosX;
pointCurPos.y = dc->CursPosY;
if(!LPtoDP(dc->hSelf, &pointCurPos, 1))
return FALSE;
if(!PATH_AddEntry(pPath, &pointCurPos, PT_MOVETO))
return FALSE;
}
/* Add the arc to the path with one Bezier spline per quadrant that the
* arc spans */
start=TRUE;
@ -848,7 +862,7 @@ BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
/* Add the Bezier spline to the path */
PATH_DoArcPart(pPath, corners, angleStartQuadrant, angleEndQuadrant,
start ? PT_MOVETO : FALSE);
start ? (lines==-1 ? PT_LINETO : PT_MOVETO) : FALSE);
start=FALSE;
} while(!end);

View File

@ -194,7 +194,7 @@ static void ok_path(HDC hdc, const path_test_t *expected, int expected_size, BOO
static const path_test_t arcto_path[] = {
{0, 0, PT_MOVETO, 0, 0}, /* 0 */
{229, 215, PT_LINETO, 0, 0}, /* 1 */
{248, 205, PT_BEZIERTO, 1, 0}, /* 2 */
{248, 205, PT_BEZIERTO, 0, 0}, /* 2 */
{273, 200, PT_BEZIERTO, 0, 0}, /* 3 */
{300, 200, PT_BEZIERTO, 0, 0}, /* 4 */
{355, 200, PT_BEZIERTO, 0, 0}, /* 5 */
@ -204,7 +204,7 @@ static const path_test_t arcto_path[] = {
{389, 275, PT_BEZIERTO, 0, 0}, /* 9 */
{370, 285, PT_BEZIERTO, 0, 0}, /* 10 */
{363, 277, PT_LINETO, 0, 0}, /* 11 */
{380, 270, PT_BEZIERTO, 1, 0}, /* 12 */
{380, 270, PT_BEZIERTO, 0, 0}, /* 12 */
{389, 260, PT_BEZIERTO, 0, 0}, /* 13 */
{389, 250, PT_BEZIERTO, 0, 0}, /* 14 */
{389, 228, PT_BEZIERTO, 0, 0}, /* 15 */
@ -232,7 +232,7 @@ static void test_arcto(void)
CloseFigure(hdc);
EndPath(hdc);
ok_path(hdc, arcto_path, sizeof(arcto_path)/sizeof(path_test_t), 1);
ok_path(hdc, arcto_path, sizeof(arcto_path)/sizeof(path_test_t), 0);
done:
ReleaseDC(0, hdc);
}