From 08cb54c4c1f77aa1bc016d17f114bb185be2f663 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 12 May 2016 21:13:47 +0200 Subject: [PATCH] Fixed wxGraphicsPath concatenation with GDI+ renderer. Since resulting wxGraphicPath should have the same state as appended path so we have to grab in wxGraphicsPath::AddPath also auxiliary data from appended wxGraphicsPath. See #17532 --- interface/wx/graphics.h | 3 ++- src/msw/graphics.cpp | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index ec6bfa7200..82911df352 100644 --- a/interface/wx/graphics.h +++ b/interface/wx/graphics.h @@ -96,7 +96,8 @@ public: void AddLineToPoint(const wxPoint2DDouble& p); /** - Adds another path. + Adds another path onto the current path. After this call the current + point will be at the added path's current point. */ virtual void AddPath(const wxGraphicsPath& path); diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index db7037457a..729c19d21c 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -1327,11 +1327,19 @@ void wxGDIPlusPathData::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDoub void wxGDIPlusPathData::AddPath( const wxGraphicsPathData* path ) { - m_path->AddPath( (GraphicsPath*) path->GetNativePath(), FALSE); - // We have to switch to the native current point. - m_logCurrentPointSet = false; -} + const wxGDIPlusPathData* pathData = static_cast(path); + const GraphicsPath* grPath = static_cast(pathData->GetNativePath()); + m_path->AddPath(grPath, FALSE); + // Copy auxiliary data if appended path is non-empty. + if( grPath->GetPointCount() > 0 || pathData->m_logCurrentPointSet || pathData->m_figureOpened ) + { + m_logCurrentPointSet = pathData->m_logCurrentPointSet; + m_logCurrentPoint = pathData->m_logCurrentPoint; + m_figureOpened = pathData->m_figureOpened; + m_figureStart = pathData->m_figureStart; + } +} // transforms each point of this path by the matrix void wxGDIPlusPathData::Transform( const wxGraphicsMatrixData* matrix )