Fix AddCurveToPoint and AddQuadCurveToPoint if no current point is set (macOS)

If current point is not yet set, these functions should behave
as if they were preceded by a call to MoveToPoint(cx1, cy1).

Closes #18111.
This commit is contained in:
Artur Wieczorek
2018-07-02 20:36:45 +02:00
parent 8349c4bf7f
commit 534b8840d2

View File

@@ -1178,11 +1178,23 @@ void wxMacCoreGraphicsPathData::AddLineToPoint( wxDouble x1 , wxDouble y1 )
void wxMacCoreGraphicsPathData::AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y )
{
// This function should be preceded by MoveToPoint(cx1, cy1)
// if current point is not yet set (CGPathAddCurveToPoint requires non-empty path).
if ( CGPathIsEmpty(m_path) )
{
MoveToPoint(cx1, cy1);
}
CGPathAddCurveToPoint( m_path , NULL , (CGFloat) cx1 , (CGFloat) cy1 , (CGFloat) cx2, (CGFloat) cy2, (CGFloat) x , (CGFloat) y );
}
void wxMacCoreGraphicsPathData::AddQuadCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble x, wxDouble y )
{
// This function should be preceded by MoveToPoint(cx1, cy1)
// if current point is not yet set (CGPathAddQuadCurveToPoint requires non-empty path).
if ( CGPathIsEmpty(m_path) )
{
MoveToPoint(cx1, cy1);
}
CGPathAddQuadCurveToPoint( m_path , NULL , (CGFloat) cx1 , (CGFloat) cy1 , (CGFloat) x , (CGFloat) y );
}