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

New commits:
commit b416c5b8e32632a63e1e791c34896e17d89f7982
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Fri Aug 23 23:54:39 2024 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 29 14:29:47 2024 +0200

    tdf#101611, tdf#108813, tdf#86211, sdext,pdfimport: Clip fills
    
    The pdf processor carefully records clip paths, but does very little
    with them.  It's currently just used in the recently added
    tiling pattern fill.
    
    Make the existing solid fills use the clip path.
    
    This resolves 101611, 108813, and helps some
    side issues in tdf#155170 In particular, the fish bowl on p.15
    now looks about correct, but the fishes are still very, erm, square.
    
    (I think there may be a longer term task to rework the clipping
    completely)
    
    Change-Id: Ie48901dbc6070465bac4fdb47b0bbc65a35c5792
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172448
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx 
b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index 876dc192d79c..0b5c5ada984b 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -463,6 +463,13 @@ void PDFIProcessor::fillPath( const uno::Reference< 
rendering::XPolyPolygon2D >&
     basegfx::B2DPolyPolygon 
aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
     aPoly.transform(getCurrentContext().Transformation);
 
+    basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip;
+    if( aCurClip.count() ) {
+        aPoly = basegfx::utils::clipPolyPolygonOnPolyPolygon( aPoly, aCurClip,
+                    true, /* bInside, keep parts inside the clip */
+                    false /* bStroke, filled not stroked */ );
+    }
+
     PolyPolyElement* pPoly = ElementFactory::createPolyPolyElement(
         m_pCurElement,
         getGCId(getCurrentContext()),
@@ -478,6 +485,13 @@ void PDFIProcessor::eoFillPath( const uno::Reference< 
rendering::XPolyPolygon2D
     basegfx::B2DPolyPolygon 
aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
     aPoly.transform(getCurrentContext().Transformation);
 
+    basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip;
+    if( aCurClip.count() ) {
+        aPoly = basegfx::utils::clipPolyPolygonOnPolyPolygon( aPoly, aCurClip,
+                    true, /* bInside, keep parts inside the clip */
+                    false /* bStroke, filled not stroked */ );
+    }
+
     PolyPolyElement* pPoly = ElementFactory::createPolyPolyElement(
         m_pCurElement,
         getGCId(getCurrentContext()),

Reply via email to