diff options
author | Philipp Lohmann <pl@openoffice.org> | 2001-05-08 16:09:13 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2001-05-08 16:09:13 +0000 |
commit | 887b7ef5a311d5abfb3f4a86e8ac2ede5f82d491 (patch) | |
tree | 52a37fd2d6df44313a2bbcd840ff5b792bc76b5d /psprint | |
parent | 07e8f14eff5a34a95979d257bbb979ae381ad1ac (diff) |
corrected DrawPolyPolygon
Diffstat (limited to 'psprint')
-rw-r--r-- | psprint/source/printergfx/common_gfx.cxx | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/psprint/source/printergfx/common_gfx.cxx b/psprint/source/printergfx/common_gfx.cxx index ff4c1aa1ec1d..c5595d58392b 100644 --- a/psprint/source/printergfx/common_gfx.cxx +++ b/psprint/source/printergfx/common_gfx.cxx @@ -2,9 +2,9 @@ * * $RCSfile: common_gfx.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: pl $ $Date: 2001-05-08 11:46:04 $ + * last change: $Author: pl $ $Date: 2001-05-08 17:09:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -488,10 +488,55 @@ PrinterGfx::DrawPolygon (sal_uInt32 nPoints, const Point* pPath) void PrinterGfx::DrawPolyPolygon (sal_uInt32 nPoly, const sal_uInt32* pSizes, const Point** pPaths ) { + // sanity check + if ( !nPoly || !pPaths || !(maFillColor.Is() || maLineColor.Is())) + return; + // could optimize for different line-color/fill-color that consecutively // invalidate each other - for( int i = 0; i < nPoly; i++ ) - DrawPolygon( pSizes[i], pPaths[i] ); + if( maFillColor.Is() && maLineColor.Is()) + PSGSave(); + + // first draw area + if( maFillColor.Is() ) + { + PSSetColor (maFillColor); + for( int i = 0; i < nPoly; i++ ) + { + Point aPoint( 0, 0 ); + sal_Int32 nColumn( 0 ); + + PSBinStartPath(); + PSBinMoveTo( pPaths[i][0], aPoint, nColumn ); + for( int n = 0; n < pSizes[i]; n++ ) + PSBinLineTo( pPaths[i][n], aPoint, nColumn ); + PSBinEndPath(); + } + WritePS (mpPageBody, "eofill\n"); + } + if( maFillColor.Is() && maLineColor.Is()) + PSGRestore(); + + // now draw outlines + if( maLineColor.Is() ) + { + PSSetColor (maLineColor); + PSSetLineWidth (); + for( int i = 0; i < nPoly; i++ ) + { + Point aPoint( 0, 0 ); + sal_Int32 nColumn( 0 ); + + PSBinStartPath(); + PSBinMoveTo( pPaths[i][0], aPoint, nColumn ); + for( int n = 0; n < pSizes[i]; n++ ) + PSBinLineTo( pPaths[i][n], aPoint, nColumn ); + if( pPaths[i][0] != pPaths[i][pSizes[i]-1] ) + PSBinLineTo( pPaths[i][0], aPoint, nColumn ); + PSBinEndPath(); + } + WritePS (mpPageBody, "stroke\n"); + } } /* |