summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx50
-rw-r--r--canvas/source/cairo/cairo_canvashelper.hxx1
-rwxr-xr-xcanvas/source/directx/dx_canvashelper.cxx11
-rwxr-xr-xcanvas/source/directx/dx_impltools.cxx67
-rwxr-xr-xcanvas/source/directx/dx_impltools.hxx15
-rwxr-xr-xcanvas/source/directx/dx_linepolypolygon.cxx4
-rwxr-xr-xcanvas/source/directx/dx_linepolypolygon.hxx2
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx19
-rw-r--r--vcl/inc/vcl/cvtsvm.hxx2
-rw-r--r--vcl/inc/vcl/lineinfo.hxx23
-rw-r--r--vcl/source/gdi/cvtsvm.cxx38
-rw-r--r--vcl/source/gdi/lineinfo.cxx30
-rw-r--r--vcl/source/gdi/outdev.cxx27
-rw-r--r--vcl/win/source/gdi/salgdi_gdiplus.cxx72
14 files changed, 303 insertions, 58 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 9cf2dd978759..5469010f2745 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -958,6 +958,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
{
@@ -967,10 +968,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* ,
@@ -1039,9 +1076,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;
@@ -1063,7 +1103,7 @@ namespace cairocanvas
// TODO(rodo) use LineArray of strokeAttributes
- doPolyPolygonPath( xPolyPolygon, Stroke );
+ doPolyPolygonPath( xPolyPolygon, Stroke, bNoLineJoin );
cairo_restore( mpCairo.get() );
} else
diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx
index 1e69a9f41e5b..90d365d63b3c 100644
--- a/canvas/source/cairo/cairo_canvashelper.hxx
+++ b/canvas/source/cairo/cairo_canvashelper.hxx
@@ -276,6 +276,7 @@ namespace cairocanvas
void doPolyPolygonPath( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
Operation aOperation,
+ bool bNoLineJoin = false,
const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >* pTextures=NULL,
::cairo::Cairo* pCairo=NULL ) const;
diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx
index dcb65c94ae3c..607f7c076e21 100755
--- a/canvas/source/directx/dx_canvashelper.cxx
+++ b/canvas/source/directx/dx_canvashelper.cxx
@@ -368,7 +368,11 @@ namespace dxcanvas
pGraphics->GetPixelOffsetMode() );
pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone );
- aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) );
+ const bool bIsMiter(rendering::PathJoinType::MITER == strokeAttributes.JoinType);
+ const bool bIsNone(rendering::PathJoinType::NONE == strokeAttributes.JoinType);
+
+ if(bIsMiter)
+ aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) );
const ::std::vector< Gdiplus::REAL >& rDashArray(
::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >(
@@ -381,9 +385,10 @@ namespace dxcanvas
aPen.SetLineCap( gdiCapFromCap(strokeAttributes.StartCapType),
gdiCapFromCap(strokeAttributes.EndCapType),
Gdiplus::DashCapFlat );
- aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) );
+ if(!bIsNone)
+ aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) );
- GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ) );
+ GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon, bIsNone ) );
// TODO(E1): Return value
Gdiplus::Status hr = pGraphics->DrawPath( &aPen, pPath.get() );
diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx
index 40164c9a1d87..4f5b92d6bcb5 100755
--- a/canvas/source/directx/dx_impltools.cxx
+++ b/canvas/source/directx/dx_impltools.cxx
@@ -194,7 +194,8 @@ namespace dxcanvas
void graphicsPathFromB2DPolygon( GraphicsPathSharedPtr& rOutput,
::std::vector< Gdiplus::PointF >& rPoints,
- const ::basegfx::B2DPolygon& rPoly )
+ const ::basegfx::B2DPolygon& rPoly,
+ bool bNoLineJoin)
{
const sal_uInt32 nPoints( rPoly.count() );
@@ -241,7 +242,18 @@ namespace dxcanvas
rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()),
static_cast<Gdiplus::REAL>(rPoint.getY()) );
- rOutput->AddBeziers( &rPoints[0], nCurrOutput );
+ if(bNoLineJoin && nCurrOutput > 7)
+ {
+ for(sal_uInt32 a(3); a < nCurrOutput; a+=3)
+ {
+ rOutput->StartFigure();
+ rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]);
+ }
+ }
+ else
+ {
+ rOutput->AddBeziers( &rPoints[0], nCurrOutput );
+ }
}
else
{
@@ -251,7 +263,20 @@ namespace dxcanvas
// Therefore, simply don't pass the last two
// points here.
if( nCurrOutput > 3 )
- rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 );
+ {
+ if(bNoLineJoin && nCurrOutput > 7)
+ {
+ for(sal_uInt32 a(3); a < nCurrOutput; a+=3)
+ {
+ rOutput->StartFigure();
+ rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]);
+ }
+ }
+ else
+ {
+ rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 );
+ }
+ }
}
}
else
@@ -267,10 +292,27 @@ namespace dxcanvas
static_cast<Gdiplus::REAL>(rPoint.getY()) );
}
- rOutput->AddLines( &rPoints[0], nPoints );
+ if(bNoLineJoin && nPoints > 2)
+ {
+ for(sal_uInt32 a(1); a < nPoints; a++)
+ {
+ rOutput->StartFigure();
+ rOutput->AddLine(rPoints[a - 1], rPoints[a]);
+ }
+
+ if(bClosedPolygon)
+ {
+ rOutput->StartFigure();
+ rOutput->AddLine(rPoints[nPoints - 1], rPoints[0]);
+ }
+ }
+ else
+ {
+ rOutput->AddLines( &rPoints[0], nPoints );
+ }
}
- if( bClosedPolygon )
+ if( bClosedPolygon && !bNoLineJoin )
rOutput->CloseFigure();
}
}
@@ -426,17 +468,17 @@ namespace dxcanvas
return pRes;
}
- GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly )
+ GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin )
{
GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() );
::std::vector< Gdiplus::PointF > aPoints;
- graphicsPathFromB2DPolygon( pRes, aPoints, rPoly );
+ graphicsPathFromB2DPolygon( pRes, aPoints, rPoly, bNoLineJoin );
return pRes;
}
- GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly )
+ GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, bool bNoLineJoin )
{
GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() );
::std::vector< Gdiplus::PointF > aPoints;
@@ -446,24 +488,25 @@ namespace dxcanvas
{
graphicsPathFromB2DPolygon( pRes,
aPoints,
- rPoly.getB2DPolygon( nCurrPoly ) );
+ rPoly.getB2DPolygon( nCurrPoly ),
+ bNoLineJoin);
}
return pRes;
}
- GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly )
+ GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly, bool bNoLineJoin )
{
LinePolyPolygon* pPolyImpl = dynamic_cast< LinePolyPolygon* >( xPoly.get() );
if( pPolyImpl )
{
- return pPolyImpl->getGraphicsPath();
+ return pPolyImpl->getGraphicsPath( bNoLineJoin );
}
else
{
return tools::graphicsPathFromB2DPolyPolygon(
- polyPolygonFromXPolyPolygon2D( xPoly ) );
+ polyPolygonFromXPolyPolygon2D( xPoly ), bNoLineJoin );
}
}
diff --git a/canvas/source/directx/dx_impltools.hxx b/canvas/source/directx/dx_impltools.hxx
index 072d1063235d..222b1a927305 100755
--- a/canvas/source/directx/dx_impltools.hxx
+++ b/canvas/source/directx/dx_impltools.hxx
@@ -107,11 +107,18 @@ namespace dxcanvas
GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence<
::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& );
- GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly );
- GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly );
+ GraphicsPathSharedPtr graphicsPathFromB2DPolygon(
+ const ::basegfx::B2DPolygon& rPoly,
+ bool bNoLineJoin = false);
+
+ GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon(
+ const ::basegfx::B2DPolyPolygon& rPoly,
+ bool bNoLineJoin = false);
+
+ GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&,
+ bool bNoLineJoin = false );
- GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XPolyPolygon2D >& );
bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics,
const BitmapSharedPtr& rBitmap );
bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics,
diff --git a/canvas/source/directx/dx_linepolypolygon.cxx b/canvas/source/directx/dx_linepolypolygon.cxx
index e63adc3dc613..9a5569384eae 100755
--- a/canvas/source/directx/dx_linepolypolygon.cxx
+++ b/canvas/source/directx/dx_linepolypolygon.cxx
@@ -46,14 +46,14 @@ namespace dxcanvas
{
}
- GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath() const
+ GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath( bool bNoLineJoin ) const
{
// generate GraphicsPath only on demand (gets deleted as soon
// as any of the modifying methods above touches the
// B2DPolyPolygon).
if( !mpPath )
{
- mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe() );
+ mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe(), bNoLineJoin );
mpPath->SetFillMode( const_cast<LinePolyPolygon*>(this)->getFillRule() == rendering::FillRule_EVEN_ODD ?
Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding );
}
diff --git a/canvas/source/directx/dx_linepolypolygon.hxx b/canvas/source/directx/dx_linepolypolygon.hxx
index 431cd1b87b4f..3e061d76e768 100755
--- a/canvas/source/directx/dx_linepolypolygon.hxx
+++ b/canvas/source/directx/dx_linepolypolygon.hxx
@@ -45,7 +45,7 @@ namespace dxcanvas
public:
explicit LinePolyPolygon( const ::basegfx::B2DPolyPolygon& );
- GraphicsPathSharedPtr getGraphicsPath() const;
+ GraphicsPathSharedPtr getGraphicsPath( bool bNoLineJoin = false) const;
private:
// overridden, to clear mpPath
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 9af540b889ea..8ea2ae453a97 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -275,10 +275,25 @@ namespace
(getState( rParms.mrStates ).mapModeTransform * aWidth).getX();
// setup reasonable defaults
- o_rStrokeAttributes.MiterLimit = 1.0;
+ o_rStrokeAttributes.MiterLimit = 15.0; // 1.0 was no good default; GDI+'s limit is 10.0, our's is 15.0
o_rStrokeAttributes.StartCapType = rendering::PathCapType::BUTT;
o_rStrokeAttributes.EndCapType = rendering::PathCapType::BUTT;
- o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER;
+
+ switch(rLineInfo.GetLineJoin())
+ {
+ default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE
+ o_rStrokeAttributes.JoinType = rendering::PathJoinType::NONE;
+ break;
+ case basegfx::B2DLINEJOIN_BEVEL:
+ o_rStrokeAttributes.JoinType = rendering::PathJoinType::BEVEL;
+ break;
+ case basegfx::B2DLINEJOIN_MITER:
+ o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER;
+ break;
+ case basegfx::B2DLINEJOIN_ROUND:
+ o_rStrokeAttributes.JoinType = rendering::PathJoinType::ROUND;
+ break;
+ }
if( LINE_DASH == rLineInfo.GetStyle() )
{
diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx
index 8a17015d99cf..cf4f3117a6ed 100644
--- a/vcl/inc/vcl/cvtsvm.hxx
+++ b/vcl/inc/vcl/cvtsvm.hxx
@@ -85,6 +85,8 @@
#define GDI_COMMENT_COMMENT 1031
#define GDI_UNICODE_COMMENT 1032
+#define GDI_LINEJOIN_ACTION 1033
+
// ----------------
// - SVMConverter -
// ----------------
diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx
index 60fdc3a3a0b0..a57513b2826b 100644
--- a/vcl/inc/vcl/lineinfo.hxx
+++ b/vcl/inc/vcl/lineinfo.hxx
@@ -32,9 +32,9 @@
#define _SV_LINEINFO_HXX
#include <vcl/dllapi.h>
-
#include <tools/gen.hxx>
#include <vcl/vclenum.hxx>
+#include <basegfx/vector/b2enums.hxx>
// ----------------
// - ImplLineInfo -
@@ -44,14 +44,16 @@ class SvStream;
struct ImplLineInfo
{
- ULONG mnRefCount;
- LineStyle meStyle;
- long mnWidth;
- USHORT mnDashCount;
- long mnDashLen;
- USHORT mnDotCount;
- long mnDotLen;
- long mnDistance;
+ ULONG mnRefCount;
+ LineStyle meStyle;
+ long mnWidth;
+ USHORT mnDashCount;
+ long mnDashLen;
+ USHORT mnDotCount;
+ long mnDotLen;
+ long mnDistance;
+
+ basegfx::B2DLineJoin meLineJoin;
ImplLineInfo();
ImplLineInfo( const ImplLineInfo& rImplLineInfo );
@@ -107,6 +109,9 @@ public:
void SetDistance( long nDistance );
long GetDistance() const { return mpImplLineInfo->mnDistance; }
+ void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
+ basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
+
BOOL IsDefault() const { return( !mpImplLineInfo->mnWidth && ( LINE_SOLID == mpImplLineInfo->meStyle ) ); }
friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo );
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index c1c02b673658..86d7d6bb39ee 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -483,6 +483,14 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
}
break;
+ case (GDI_LINEJOIN_ACTION) :
+ {
+ INT16 nLineJoin(0);
+ rIStm >> nLineJoin;
+ aLineInfo.SetLineJoin((basegfx::B2DLineJoin)nLineJoin);
+ }
+ break;
+
case( GDI_RECT_ACTION ):
{
ImplReadRect( rIStm, aRect );
@@ -1247,12 +1255,20 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
MetaLineAction* pAct = (MetaLineAction*) pAction;
const LineInfo& rInfo = pAct->GetLineInfo();
- const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) );
+ const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
+ const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
if( bFatLine )
{
ImplWritePushAction( rOStm );
ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
+
+ if(bLineJoin)
+ {
+ rOStm << (INT16) GDI_LINEJOIN_ACTION;
+ rOStm << (INT32) 6;
+ rOStm << (INT16) rInfo.GetLineJoin();
+ }
}
rOStm << (INT16) GDI_LINE_ACTION;
@@ -1265,6 +1281,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
ImplWritePopAction( rOStm );
nCount += 3;
+
+ if(bLineJoin)
+ {
+ nCount += 1;
+ }
}
}
break;
@@ -1356,12 +1377,20 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
const Polygon& rPoly = pAct->GetPolygon();
const LineInfo& rInfo = pAct->GetLineInfo();
const USHORT nPoints = rPoly.GetSize();
- const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) );
+ const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
+ const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
if( bFatLine )
{
ImplWritePushAction( rOStm );
ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
+
+ if(bLineJoin)
+ {
+ rOStm << (INT16) GDI_LINEJOIN_ACTION;
+ rOStm << (INT32) 6;
+ rOStm << (INT16) rInfo.GetLineJoin();
+ }
}
rOStm << (INT16) GDI_POLYLINE_ACTION;
@@ -1377,6 +1406,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
ImplWritePopAction( rOStm );
nCount += 3;
+
+ if(bLineJoin)
+ {
+ nCount += 1;
+ }
}
}
break;
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index 98f16713a145..85a48f2b0f5e 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -49,7 +49,8 @@ ImplLineInfo::ImplLineInfo() :
mnDashLen ( 0 ),
mnDotCount ( 0 ),
mnDotLen ( 0 ),
- mnDistance ( 0 )
+ mnDistance ( 0 ),
+ meLineJoin ( basegfx::B2DLINEJOIN_ROUND )
{
}
@@ -63,7 +64,8 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) :
mnDashLen ( rImplLineInfo.mnDashLen ),
mnDotCount ( rImplLineInfo.mnDotCount ),
mnDotLen ( rImplLineInfo.mnDotLen ),
- mnDistance ( rImplLineInfo.mnDistance )
+ mnDistance ( rImplLineInfo.mnDistance ),
+ meLineJoin ( rImplLineInfo.meLineJoin )
{
}
@@ -209,6 +211,19 @@ void LineInfo::SetDistance( long nDistance )
// -----------------------------------------------------------------------
+void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin)
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+
+ if(eLineJoin != mpImplLineInfo->meLineJoin)
+ {
+ ImplMakeUnique();
+ mpImplLineInfo->meLineJoin = eLineJoin;
+ }
+}
+
+// -----------------------------------------------------------------------
+
SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
{
VersionCompat aCompat( rIStm, STREAM_READ );
@@ -225,6 +240,12 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
rIStm >> rImplLineInfo.mnDistance;
}
+ if( aCompat.GetVersion() >= 3 )
+ {
+ // version 3
+ rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16;
+ }
+
return rIStm;
}
@@ -232,7 +253,7 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
{
- VersionCompat aCompat( rOStm, STREAM_WRITE, 2 );
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
// version 1
rOStm << (UINT16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth;
@@ -242,6 +263,9 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen;
rOStm << rImplLineInfo.mnDistance;
+ // since version3
+ rOStm << (UINT16) rImplLineInfo.meLineJoin;
+
return rOStm;
}
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 5b543258cb0b..e86256bc4830 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -2541,7 +2541,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo
if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
&& LINE_SOLID == rLineInfo.GetStyle())
{
- DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), basegfx::B2DLINEJOIN_ROUND);
+ DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin());
return;
}
@@ -3042,7 +3042,12 @@ void OutputDevice::DrawPolyLine(
SetFillColor(aOldLineColor);
ImplInitFillColor();
- ImpDrawPolyPolygonWithB2DPolyPolygon(aAreaPolyPolygon);
+ // draw usig a loop; else the topology will paint a PolyPolygon
+ for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++)
+ {
+ ImpDrawPolyPolygonWithB2DPolyPolygon(
+ basegfx::B2DPolyPolygon(aAreaPolyPolygon.getB2DPolygon(a)));
+ }
SetLineColor(aOldLineColor);
ImplInitLineColor();
@@ -3059,14 +3064,16 @@ void OutputDevice::DrawPolyLine(
}
}
}
-
- // fallback to old polygon drawing if needed. This will really
- // use ImplLineConverter, but still try to AA lines
- const Polygon aToolsPolygon( rB2DPolygon );
- LineInfo aLineInfo;
- if( fLineWidth != 0.0 )
- aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
- ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo );
+ else
+ {
+ // fallback to old polygon drawing if needed. This will really
+ // use ImplLineConverter, but still try to AA lines
+ const Polygon aToolsPolygon( rB2DPolygon );
+ LineInfo aLineInfo;
+ if( fLineWidth != 0.0 )
+ aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
+ ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo );
+ }
}
// -----------------------------------------------------------------------
diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx
index 5c00c786e22d..a9d346e74476 100644
--- a/vcl/win/source/gdi/salgdi_gdiplus.cxx
+++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx
@@ -62,9 +62,9 @@
// -----------------------------------------------------------------------
-void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon)
+void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
{
- const sal_uInt32 nCount(rPolygon.count());
+ sal_uInt32 nCount(rPolygon.count());
if(nCount)
{
@@ -97,8 +97,58 @@ void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const b
if(a + 1 < nEdgeCount)
{
- aCurr = aNext;
aFCurr = aFNext;
+
+ if(bNoLineJoin)
+ {
+ rPath.StartFigure();
+ }
+ }
+ }
+ }
+}
+
+void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
+{
+ sal_uInt32 nCount(rPolygon.count());
+
+ if(nCount)
+ {
+ const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1);
+ const bool bControls(rPolygon.areControlPointsUsed());
+ basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0));
+ Gdiplus::Point aICurr(INT(aCurr.getX()), INT(aCurr.getY()));
+
+ for(sal_uInt32 a(0); a < nEdgeCount; a++)
+ {
+ const sal_uInt32 nNextIndex((a + 1) % nCount);
+ const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex));
+ const Gdiplus::Point aINext(INT(aNext.getX()), INT(aNext.getY()));
+
+ if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex)))
+ {
+ const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a));
+ const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex));
+
+ rPath.AddBezier(
+ aICurr,
+ Gdiplus::Point(INT(aCa.getX()), INT(aCa.getY())),
+ Gdiplus::Point(INT(aCb.getX()), INT(aCb.getY())),
+ aINext);
+ }
+ else
+ {
+ rPath.AddLine(aICurr, aINext);
+ }
+
+ if(a + 1 < nEdgeCount)
+ {
+ aICurr = aINext;
+
+ if(bNoLineJoin)
+ {
+ rPath.StartFigure();
+ }
}
}
}
@@ -123,7 +173,7 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly
aPath.StartFigure(); // #i101491# not needed for first run
}
- impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolyPolygon.getB2DPolygon(a));
+ impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolyPolygon.getB2DPolygon(a), false);
aPath.CloseFigure();
}
@@ -152,11 +202,16 @@ bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const bas
Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor));
Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX()));
Gdiplus::GraphicsPath aPath;
+ bool bNoLineJoin(false);
switch(eLineJoin)
{
default : // basegfx::B2DLINEJOIN_NONE :
{
+ if(basegfx::fTools::more(rLineWidths.getX(), 0.0))
+ {
+ bNoLineJoin = true;
+ }
break;
}
case basegfx::B2DLINEJOIN_BEVEL :
@@ -179,7 +234,14 @@ bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const bas
}
}
- impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolygon);
+ if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5))
+ {
+ impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin);
+ }
+ else
+ {
+ impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolygon, bNoLineJoin);
+ }
if(rPolygon.isClosed())
{