From 66e3a3f7249334c6d18f6ef6a359e58cacb75db8 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 9 May 2016 18:41:16 +0200 Subject: [PATCH] Fixed adding a Bezier curve to wxGraphicsPath with Direct2D renderer. When current point is not set before the call to wxGraphicsPath::AddCurveToPoint() then it should be set at first control point prior to adding a curve (function should behave as if preceded by MoveToPoint). Closes #17526 --- src/msw/graphicsd2d.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 8ecccb3f8e..76e4152987 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -1190,7 +1190,13 @@ void wxD2DPathData::AddLineToPoint(wxDouble x, wxDouble y) // adds a cubic Bezier curve from the current point, using two control points and an end point void wxD2DPathData::AddCurveToPoint(wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y) { - EnsureFigureOpen(m_currentPoint.x, m_currentPoint.y); + // If no current point is set then this function should behave + // as if preceded by a call to MoveToPoint(cx1, cy1). + if( m_currentPointSet ) + EnsureFigureOpen(m_currentPoint.x, m_currentPoint.y); + else + MoveToPoint(cx1, cy1); + D2D1_BEZIER_SEGMENT bezierSegment = { { (FLOAT)cx1, (FLOAT)cy1 }, { (FLOAT)cx2, (FLOAT)cy2 },