sdext/source/pdfimport/tree/pdfiprocessor.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit abfbca2719767516d5a35ee641ddd0d96d93e4ea
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Thu Nov 21 16:15:32 2024 +0000
Commit:     David Gilbert <d...@treblig.org>
CommitDate: Thu Dec 5 02:38:54 2024 +0100

    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 <freedesk...@treblig.org>

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()),

Reply via email to