diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-08-19 23:33:45 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-08-19 23:33:45 +0000 |
commit | b8823de0a72436087ef036895d6c1215c6acfc16 (patch) | |
tree | 6d321349de45279194a41708882ebc28f0a802d3 /vcl/source | |
parent | c1528ac98169a3190f1795799e4973995cae0fb0 (diff) |
INTEGRATION: CWS aw033 (1.114.10); FILE MERGED
2008/07/11 11:42:26 aw 1.114.10.10: RESYNC: (1.129-1.132); FILE MERGED
2008/06/25 13:10:31 aw 1.114.10.9: RESYNC: (1.127-1.129); FILE MERGED
2008/05/14 15:09:14 aw 1.114.10.8: RESYNC: (1.123-1.127); FILE MERGED
2008/03/14 14:36:49 cl 1.114.10.7: RESYNC: (1.122-1.123); FILE MERGED
2008/02/12 11:36:25 aw 1.114.10.6: RESYNC: (1.120-1.122); FILE MERGED
2008/01/29 13:15:19 aw 1.114.10.5: RESYNC: (1.118-1.120); FILE MERGED
2007/12/03 16:42:19 aw 1.114.10.4: RESYNC: (1.114-1.118); FILE MERGED
2007/11/22 15:07:39 aw 1.114.10.3: #i39532# polygon bezier changes
2007/11/20 10:28:52 aw 1.114.10.2: #i39532# adaptions to bezier
2007/11/07 14:59:52 aw 1.114.10.1: #i39532# committing to have a base for HDU
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 1a64172bfe2a..adad801c2bef 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: pdfwriter_impl.cxx,v $ - * $Revision: 1.132 $ + * $Revision: 1.133 $ * * This file is part of OpenOffice.org. * @@ -39,6 +39,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <rtl/ustrbuf.hxx> #include <tools/debug.hxx> #include <tools/zcodec.hxx> @@ -8438,24 +8439,47 @@ void PDFWriterImpl::drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLine } else { - basegfx::B2DPolygon aPoly( rPoly.getB2DPolygon() ); - basegfx::B2DPolyPolygon aPolyPoly( basegfx::tools::applyLineDashing( aPoly, rInfo.m_aDashArray ) ); - sal_uInt32 nPolygons = aPolyPoly.count(); - for( sal_uInt32 nPoly = 0; nPoly < nPolygons; nPoly++ ) + basegfx::B2DPolygon aPoly(rPoly.getB2DPolygon()); + basegfx::B2DPolyPolygon aPolyPoly; + + basegfx::tools::applyLineDashing(aPoly, rInfo.m_aDashArray, &aPolyPoly); + + // Old applyLineDashing subdivided the polygon. New one will create bezier curve segments. + // To mimic old behaviour, apply subdivide here. If beziers shall be written (better quality) + // this line needs to be removed and the loop below adapted accordingly + aPolyPoly = basegfx::tools::adaptiveSubdivideByAngle(aPolyPoly); + + const sal_uInt32 nPolygonCount(aPolyPoly.count()); + + for( sal_uInt32 nPoly = 0; nPoly < nPolygonCount; nPoly++ ) { aLine.append( (nPoly != 0 && (nPoly & 7) == 0) ? "\n" : " " ); aPoly = aPolyPoly.getB2DPolygon( nPoly ); - DBG_ASSERT( aPoly.count() == 2, "erroneous sub polygon" ); - basegfx::B2DPoint aStart = aPoly.getB2DPoint( 0 ); - basegfx::B2DPoint aStop = aPoly.getB2DPoint( 1 ); - m_aPages.back().appendPoint( Point( FRound(aStart.getX()), - FRound(aStart.getY()) ), - aLine ); - aLine.append( " m " ); - m_aPages.back().appendPoint( Point( FRound(aStop.getX()), - FRound(aStop.getY()) ), - aLine ); - aLine.append( " l" ); + const sal_uInt32 nPointCount(aPoly.count()); + + if(nPointCount) + { + const sal_uInt32 nEdgeCount(aPoly.isClosed() ? nPointCount : nPointCount - 1); + basegfx::B2DPoint aCurrent(aPoly.getB2DPoint(0)); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nPointCount); + const basegfx::B2DPoint aNext(aPoly.getB2DPoint(nNextIndex)); + + m_aPages.back().appendPoint( Point( FRound(aCurrent.getX()), + FRound(aCurrent.getY()) ), + aLine ); + aLine.append( " m " ); + m_aPages.back().appendPoint( Point( FRound(aNext.getX()), + FRound(aNext.getY()) ), + aLine ); + aLine.append( " l" ); + + // prepare next edge + aCurrent = aNext; + } + } } aLine.append( " S " ); writeBuffer( aLine.getStr(), aLine.getLength() ); |