summaryrefslogtreecommitdiff
path: root/canvas/source/cairo/cairo_canvashelper.cxx
diff options
context:
space:
mode:
authorthb <thb@openoffice.org>2010-01-18 01:10:42 +0100
committerthb <thb@openoffice.org>2010-01-18 01:10:42 +0100
commitea48c18b848fed4d6504c956adeb3f24f05938ca (patch)
tree1eccf884707ec16e4dd74f8e83c74563e1539b34 /canvas/source/cairo/cairo_canvashelper.cxx
parent1737f4d2fdba50a590f76631cd7ca7e762d18c35 (diff)
parent8765a3bf9f2926a50d0f644e4263782269abe023 (diff)
thbfixes10: merge with DEV300 m69
Diffstat (limited to 'canvas/source/cairo/cairo_canvashelper.cxx')
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx50
1 files changed, 45 insertions, 5 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 7e373d3bfe1d..f0ba4067f899 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1047,6 +1047,7 @@ namespace cairocanvas
void CanvasHelper::doPolyPolygonPath( const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
Operation aOperation,
+ bool bNoLineJoin,
const uno::Sequence< rendering::Texture >* pTextures,
Cairo* pCairo ) const
{
@@ -1056,10 +1057,46 @@ namespace cairocanvas
if( !pCairo )
pCairo = mpCairo.get();
- doPolyPolygonImplementation( rPolyPoly, aOperation,
- pCairo, pTextures,
- mpSurfaceProvider,
- xPolyPolygon->getFillRule() );
+ if(bNoLineJoin && Stroke == aOperation)
+ {
+ // emulate rendering::PathJoinType::NONE by painting single edges
+ for(sal_uInt32 a(0); a < rPolyPoly.count(); a++)
+ {
+ const basegfx::B2DPolygon aCandidate(rPolyPoly.getB2DPolygon(a));
+ const sal_uInt32 nPointCount(aCandidate.count());
+
+ if(nPointCount)
+ {
+ const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1: nPointCount);
+ basegfx::B2DPolygon aEdge;
+ aEdge.append(aCandidate.getB2DPoint(0));
+ aEdge.append(basegfx::B2DPoint(0.0, 0.0));
+
+ for(sal_uInt32 a(0); a < nEdgeCount; a++)
+ {
+ const sal_uInt32 nNextIndex((a + 1) % nPointCount);
+ aEdge.setB2DPoint(1, aCandidate.getB2DPoint(nNextIndex));
+ aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a));
+ aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex));
+
+ doPolyPolygonImplementation( aEdge, aOperation,
+ pCairo, pTextures,
+ mpSurfaceProvider,
+ xPolyPolygon->getFillRule() );
+
+ // prepare next step
+ aEdge.setB2DPoint(0, aEdge.getB2DPoint(1));
+ }
+ }
+ }
+ }
+ else
+ {
+ doPolyPolygonImplementation( rPolyPoly, aOperation,
+ pCairo, pTextures,
+ mpSurfaceProvider,
+ xPolyPolygon->getFillRule() );
+ }
}
uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* ,
@@ -1128,9 +1165,12 @@ namespace cairocanvas
break;
}
+ bool bNoLineJoin(false);
+
switch( strokeAttributes.JoinType ) {
// cairo doesn't have join type NONE so we use MITER as it's pretty close
case rendering::PathJoinType::NONE:
+ bNoLineJoin = true;
case rendering::PathJoinType::MITER:
cairo_set_line_join( mpCairo.get(), CAIRO_LINE_JOIN_MITER );
break;
@@ -1152,7 +1192,7 @@ namespace cairocanvas
// TODO(rodo) use LineArray of strokeAttributes
- doPolyPolygonPath( xPolyPolygon, Stroke );
+ doPolyPolygonPath( xPolyPolygon, Stroke, bNoLineJoin );
cairo_restore( mpCairo.get() );
} else