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 <freedesktop@treblig.org>
This commit is contained in:
Dr. David Alan Gilbert 2024-11-21 16:15:32 +00:00 committed by David Gilbert
parent 4ffd1e31b1
commit abfbca2719

View file

@ -452,8 +452,15 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1,
void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D >& rPath ) void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D >& rPath )
{ {
basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip;
aPoly.transform(getCurrentContext().Transformation); 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( PolyPolyElement* pPoly = ElementFactory::createPolyPolyElement(
m_pCurElement, m_pCurElement,
getGCId(getCurrentContext()), getGCId(getCurrentContext()),