diff --git a/docs/doxygen/images/drawing-addarctopoint.png b/docs/doxygen/images/drawing-addarctopoint.png index e3aa71932a..96570d4b08 100644 Binary files a/docs/doxygen/images/drawing-addarctopoint.png and b/docs/doxygen/images/drawing-addarctopoint.png differ diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index 7361413c4b..2e1bd40477 100644 --- a/interface/wx/graphics.h +++ b/interface/wx/graphics.h @@ -55,6 +55,8 @@ public: to the line connecting (@a x1, @a y1) and (@a x2, @a y2). If the current point and the starting point of the arc are different, a straight line connecting these points is also appended. + If there is no current point before the call to AddArcToPoint() this + function will behave as if preceded by a call to MoveToPoint(0, 0). After this call the current point will be at the ending point of the arc. @image html drawing-addarctopoint.png diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index 3d70b9a202..fc0e6ab894 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -455,6 +455,12 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, { wxPoint2DDouble current; GetCurrentPoint(¤t.m_x, ¤t.m_y); + if ( current == wxPoint(0, 0) ) + { + // (0, 0) is returned by GetCurrentPoint() also when the last point is not yet actually set, + // so we should reposition it to (0, 0) to be sure that a last point is initially set. + MoveToPoint(0, 0); + } wxPoint2DDouble p1(x1, y1); wxPoint2DDouble p2(x2, y2); diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index f3d6137ea1..cf292a26e4 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -1223,6 +1223,12 @@ void wxMacCoreGraphicsPathData::AddArc( wxDouble x, wxDouble y, wxDouble r, wxDo void wxMacCoreGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) { + // This function should be preceded by MoveToPoint(0, 0) + // if current point is not yet set (CGPathAddArcToPoint requires non-empty path). + if ( CGPathIsEmpty(m_path) ) + { + MoveToPoint(0, 0); + } CGPathAddArcToPoint( m_path, NULL , (CGFloat) x1, (CGFloat) y1, (CGFloat) x2, (CGFloat) y2, (CGFloat) r); }