diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 487ba20..477bf76 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -448,16 +448,28 @@ void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D void PDFIProcessor::fillPath( const uno::Reference< rendering::XPolyPolygon2D >& rPath ) { - basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); - aPoly.transform(getCurrentContext().Transformation); + GraphicsContext& gc = getCurrentContext(); - PolyPolyElement* pPoly = m_pElFactory->createPolyPolyElement( - m_pCurElement, - getGCId(getCurrentContext()), - aPoly, - PATH_FILL ); - pPoly->updateGeometry(); - pPoly->ZOrder = m_nNextZOrder++; + if (gc.Clip.count() == 0) + return; + + basegfx::B2DPolyPolygon aPoly = + basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); + aPoly.transform(gc.Transformation); + + aPoly = basegfx::tools::clipPolyPolygonOnPolyPolygon( + aPoly, gc.Clip, true, false); + + if (aPoly.count() == 0) + return; + + PolyPolyElement* pPoly = m_pElFactory->createPolyPolyElement( + m_pCurElement, + getGCId(gc), + aPoly, + PATH_FILL); + pPoly->updateGeometry(); + pPoly->ZOrder = m_nNextZOrder++; } void PDFIProcessor::eoFillPath( const uno::Reference< rendering::XPolyPolygon2D >& rPath ) @@ -476,13 +488,17 @@ void PDFIProcessor::eoFillPath( const uno::Reference< rendering::XPolyPolygon2D void PDFIProcessor::intersectClip(const uno::Reference< rendering::XPolyPolygon2D >& rPath) { + if (getCurrentContext().Clip.count() == 0) + return; + // TODO(F3): interpret fill mode - basegfx::B2DPolyPolygon aNewClip = basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); + basegfx::B2DPolyPolygon aNewClip = + basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); aNewClip.transform(getCurrentContext().Transformation); basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip; - if( aCurClip.count() ) // #i92985# adapted API from (..., false, false) to (..., true, false) - aNewClip = basegfx::tools::clipPolyPolygonOnPolyPolygon( aCurClip, aNewClip, true, false ); + aNewClip = basegfx::tools::clipPolyPolygonOnPolyPolygon( + aCurClip, aNewClip, true, false); getCurrentContext().Clip = aNewClip; }