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:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user