From abfbca2719767516d5a35ee641ddd0d96d93e4ea Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 21 Nov 2024 16:15:32 +0000 Subject: [PATCH] tdf#85428: Clip strokes Clip stroke paths coming from the PDF import. Similar to my previous patches for fills. (It's possible we might have to do something clever with cropping of arrows/etc but not sure yet) Change-Id: I9e46deac4a722e3ac510f0cc4bdb6b38b67c579e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176952 Tested-by: Jenkins Reviewed-by: David Gilbert --- sdext/source/pdfimport/tree/pdfiprocessor.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 02efb2f9e3ff..d81967b5e9be 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -452,8 +452,15 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1, void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D >& rPath ) { basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); + basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip; aPoly.transform(getCurrentContext().Transformation); + if( aCurClip.count() ) { + aPoly = basegfx::utils::clipPolyPolygonOnPolyPolygon( aPoly, aCurClip, + true, /* bInside, keep parts inside the clip */ + true /* bStroke, stroked */ ); + } + PolyPolyElement* pPoly = ElementFactory::createPolyPolyElement( m_pCurElement, getGCId(getCurrentContext()),