From f258dc4c643f179f5cdcca3f578be2324737cc7b Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 2 Jul 2018 20:24:43 +0200 Subject: [PATCH] Fix setting current point of wxGraphicsPath (GDI+) After executing native operations on the graphics path, the native current point is updated properly and should be used instead of manually maintained logical point. See #18111. --- src/msw/graphics.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index 9e87c937d1..f7c014d9d4 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -1280,9 +1280,6 @@ void wxGDIPlusPathData::AddLineToPoint( wxDouble x , wxDouble y ) if ( m_logCurrentPointSet ) { start = m_logCurrentPoint; - // After calling AddLine() the native current point - // will be updated and can be used. - m_logCurrentPointSet = false; } else { @@ -1296,6 +1293,8 @@ void wxGDIPlusPathData::AddLineToPoint( wxDouble x , wxDouble y ) } } m_path->AddLine(start.X, start.Y, (REAL)x, (REAL)y); + // After calling AddLine() the native current point will be updated and can be used. + m_logCurrentPointSet = false; } void wxGDIPlusPathData::CloseSubpath() @@ -1326,9 +1325,6 @@ void wxGDIPlusPathData::AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx if ( m_logCurrentPointSet ) { start = m_logCurrentPoint; - // After calling AddBezier() the native current point - // will be updated and can be used. - m_logCurrentPointSet = false; } else { @@ -1339,6 +1335,8 @@ void wxGDIPlusPathData::AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx } } m_path->AddBezier(start,c1,c2,end); + // After calling AddBezier() the native current point will be updated and can be used. + m_logCurrentPointSet = false; } // gets the last point of the current path, (0,0) if not yet set @@ -1450,11 +1448,15 @@ void wxGDIPlusPathData::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDoub void wxGDIPlusPathData::AddCircle(wxDouble x, wxDouble y, wxDouble r) { m_path->AddEllipse((REAL)(x-r), (REAL)(y-r), (REAL)(2.0*r), (REAL)(2.0*r)); + // After calling AddEllipse() the native current point will be updated and can be used. + m_logCurrentPointSet = false; } void wxGDIPlusPathData::AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) { m_path->AddEllipse((REAL)x, (REAL)y, (REAL)w, (REAL)h); + // After calling AddEllipse() the native current point will be updated and can be used. + m_logCurrentPointSet = false; } void wxGDIPlusPathData::AddPath( const wxGraphicsPathData* path )