From c472b19e0dda7b3950964fa531cfd85e4670bb8a Mon Sep 17 00:00:00 2001 From: Green Date: Tue, 24 Dec 2024 13:07:45 +0300 Subject: [PATCH] Fix bug#72243 --- .../Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp | 15 ++++++++++++++- .../Emf/EmfInterpretator/CEmfInterpretatorSvg.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp b/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp index 5887063404..db78257382 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp +++ b/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp @@ -33,7 +33,8 @@ namespace MetaFile return; std::swap(m_pParser, m_oSecondConditional.m_pParser); - std::swap(m_oClip, m_oSecondConditional.m_oClip); + + SwapClips(m_oClip, m_oSecondConditional.m_oClip); } InterpretatorType CEmfInterpretatorSvg::GetType() const @@ -1046,6 +1047,7 @@ namespace MetaFile void CEmfInterpretatorSvg::HANDLE_EMR_FRAMERGN(const TRectL &oBounds, unsigned int unIhBrush, int nWidth, int nHeight, const TRegionDataHeader &oRegionDataHeader, const std::vector &arRects) { + m_bUpdatedClip = false; } void CEmfInterpretatorSvg::HANDLE_EMFPLUS_OFFSETCLIP(double dX, double dY) @@ -1493,6 +1495,17 @@ namespace MetaFile CInterpretatorSvgBase::PathClip(oPath, nClipMode, pTransform); } + void CEmfInterpretatorSvg::SwapClips(CSvgClip& oFirstClip, CSvgClip& oSecondClip) + { + if (oFirstClip.StartedClip()) + WriteNodeEnd(L"g"); + + if (oSecondClip.StartedClip()) + WriteNodeBegin(L"g", {{L"clip-path", L"url(#" + oSecondClip.GetClipId() + L')'}}); + + std::swap(oFirstClip, oSecondClip); + } + TRectD CEmfInterpretatorSvg::TranslateRect(const TRectL &oRect) const { TRectD oNewRect(oRect.Left, oRect.Top, oRect.Right, oRect.Bottom); diff --git a/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.h b/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.h index 1503e59034..bb550a35cd 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.h +++ b/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.h @@ -226,6 +226,8 @@ namespace MetaFile void SetTransform(double& dM11, double& dM12, double& dM21, double& dM22, double& dX, double& dY) override {}; void GetTransform(double* pdM11, double* pdM12, double* pdM21, double* pdM22, double* pdX, double* pdY) override {}; + void SwapClips(CSvgClip& oFirstClip, CSvgClip& oSecondClip); + TRectD TranslateRect(const TRectL &oRect) const; }; }