Misha Koshelev : gdi32: Handle ArcTo in paths as native.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jun 21 09:47:38 CDT 2007


Module: wine
Branch: master
Commit: 859bf44c3389c843cf47866ca8e474e3b0e54146
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=859bf44c3389c843cf47866ca8e474e3b0e54146

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Wed Jun 20 17:02:58 2007 -0500

gdi32: Handle ArcTo in paths as native.

---

 dlls/gdi32/painting.c   |    4 +++-
 dlls/gdi32/path.c       |   22 ++++++++++++++++++----
 dlls/gdi32/tests/path.c |    6 +++---
 3 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 838e0e0..ea36421 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -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 */
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 7999fef..1a37adc 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -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);
 
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index 2a80377..e567106 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -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);
 }




More information about the wine-cvs mailing list