Fix AddArcToPoint when no current point is set on wxGraphicsPath

Current behavior of AddArcToPoint() when there is no current point is not
documented and moreover it is not the same in native macOS and in generic
implementation. Under macOS nothing is done and "no current point" error
is raised but under other ports (generic implementation) only arc
is drawn (without initial line).
When there is no current point, in similar functions AddCurveToPoint(),
AddQuadCurveToPoint() it is initially set to the some known control point
of the curve but this approach cannot be applied to AddArcToPoint().
The only well defined fallback point seems to be (0, 0) and this option
is implemented here.

See #18086.
This commit is contained in:
Artur Wieczorek
2018-07-02 18:10:06 +02:00
parent fd5576a326
commit 9acb2fe3a0
4 changed files with 14 additions and 0 deletions

View File

@@ -455,6 +455,12 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2,
{
wxPoint2DDouble current;
GetCurrentPoint(&current.m_x, &current.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);