From 534b8840d2b8b4edb8e7a888b3fdf064ed013a87 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 2 Jul 2018 20:36:45 +0200 Subject: [PATCH] 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. --- src/osx/carbon/graphics.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index a77b9f7b19..147e237e35 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -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 ); }