diff --git a/darwin/draw.m b/darwin/draw.m index 337bd30d..514590f3 100644 --- a/darwin/draw.m +++ b/darwin/draw.m @@ -40,7 +40,7 @@ void uiDrawPathNewFigureWithArc(uiDrawPath *p, double xCenter, double yCenter, d sinStart = sin(startAngle); cosStart = cos(startAngle); startx = xCenter + radius * cosStart; - starty = yCenter - radius * sinStart; + starty = yCenter + radius * sinStart; CGPathMoveToPoint(p->path, NULL, startx, starty); uiDrawPathArcTo(p, xCenter, yCenter, radius, startAngle, sweep); } @@ -61,8 +61,7 @@ void uiDrawPathArcTo(uiDrawPath *p, double xCenter, double yCenter, double radiu CGPathAddRelativeArc(p->path, NULL, xCenter, yCenter, radius, - // TODO explain this - -startAngle, -sweep); + startAngle, sweep); } void uiDrawPathBezierTo(uiDrawPath *p, double c1x, double c1y, double c2x, double c2y, double endX, double endY) diff --git a/unix/draw.c b/unix/draw.c index 2bcbce78..001e76b2 100644 --- a/unix/draw.c +++ b/unix/draw.c @@ -152,15 +152,12 @@ static void runPath(uiDrawPath *p, cairo_t *cr) cairo_new_sub_path(cr); // fall through case arcTo: - // cairo_arc() and cairo_arc_negative() only go clockwise - // TODO explain why this works - // don't use cairo_arc(); that requires us to put the starting point as the ending point - cairo_arc_negative(cr, + cairo_arc(cr, piece->d[0], piece->d[1], piece->d[2], - -(piece->d[3]), - -(piece->d[3] + piece->d[4])); + piece->d[3], + piece->d[3] + piece->d[4]); break; case lineTo: cairo_line_to(cr, piece->d[0], piece->d[1]); diff --git a/windows/draw.c b/windows/draw.c index 9fab786d..a9d41901 100644 --- a/windows/draw.c +++ b/windows/draw.c @@ -185,11 +185,11 @@ static void drawArc(uiDrawPath *p, struct arc *a, void (*startFunction)(uiDrawPa sinx = sin(a->startAngle); cosx = cos(a->startAngle); startX = a->xCenter + a->radius * cosx; - startY = a->yCenter - a->radius * sinx; + startY = a->yCenter + a->radius * sinx; sinx = sin(a->startAngle + a->sweep); cosx = cos(a->startAngle + a->sweep); endX = a->xCenter + a->radius * cosx; - endY = a->yCenter - a->radius * sinx; + endY = a->yCenter + a->radius * sinx; // now do the initial step to get the current point to be the start point // this is either creating a new figure, drawing a line, or (in the case of our full circle code above) doing nothing @@ -202,7 +202,7 @@ static void drawArc(uiDrawPath *p, struct arc *a, void (*startFunction)(uiDrawPa as.size.width = a->radius; as.size.height = a->radius; as.rotationAngle = 0; // as above, not relevant for circles - as.sweepDirection = D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE; + as.sweepDirection = D2D1_SWEEP_DIRECTION_CLOCKWISE; if (a->sweep > M_PI) as.arcSize = D2D1_ARC_SIZE_LARGE; else