diff options
Diffstat (limited to 'vcl')
-rwxr-xr-x | vcl/aqua/source/gdi/salgdi.cxx | 6 | ||||
-rw-r--r-- | vcl/inc/aqua/salgdi.h | 7 | ||||
-rw-r--r-- | vcl/inc/os2/salgdi.h | 7 | ||||
-rwxr-xr-x | vcl/inc/salgdi.hxx | 17 | ||||
-rw-r--r-- | vcl/inc/unx/pspgraphics.h | 7 | ||||
-rw-r--r-- | vcl/inc/unx/salgdi.h | 7 | ||||
-rw-r--r-- | vcl/inc/vcl/cvtsvm.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/vcl/lineinfo.hxx | 7 | ||||
-rw-r--r-- | vcl/inc/vcl/outdev.hxx | 14 | ||||
-rw-r--r-- | vcl/inc/vcl/print.hxx | 5 | ||||
-rwxr-xr-x | vcl/inc/win/salgdi.h | 7 | ||||
-rw-r--r-- | vcl/source/gdi/cvtsvm.cxx | 52 | ||||
-rw-r--r-- | vcl/source/gdi/lineinfo.cxx | 45 | ||||
-rw-r--r-- | vcl/source/gdi/outdev.cxx | 70 | ||||
-rw-r--r-- | vcl/source/gdi/outdev6.cxx | 4 | ||||
-rwxr-xr-x | vcl/source/gdi/pdfwriter_impl.cxx | 88 | ||||
-rwxr-xr-x | vcl/source/gdi/salgdilayout.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/pspgraphics.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/headless/svpgdi.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/headless/svpgdi.hxx | 7 | ||||
-rw-r--r-- | vcl/unx/headless/svppspgraphics.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/headless/svppspgraphics.hxx | 7 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi_gdiplus.cxx | 28 |
24 files changed, 357 insertions, 76 deletions
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 444436cad5d9..b2652ac17437 100755 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -980,10 +980,12 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol // ----------------------------------------------------------------------- -bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, +bool AquaSalGraphics::drawPolyLine( + const ::basegfx::B2DPolygon& rPolyLine, double fTransparency, const ::basegfx::B2DVector& rLineWidths, - basegfx::B2DLineJoin eLineJoin ) + basegfx::B2DLineJoin eLineJoin, + com::sun::star::drawing::LineCap eLineCap) { // short circuit if there is nothing to do const int nPointCount = rPolyLine.count(); diff --git a/vcl/inc/aqua/salgdi.h b/vcl/inc/aqua/salgdi.h index 7d53df93a46c..8cc6dd7ba6fd 100644 --- a/vcl/inc/aqua/salgdi.h +++ b/vcl/inc/aqua/salgdi.h @@ -186,7 +186,12 @@ public: virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uLong nPoly, const sal_uLong* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( + const ::basegfx::B2DPolygon&, + double fTransparency, + const ::basegfx::B2DVector& rLineWidths, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap eLineCap); // CopyArea --> No RasterOp, but ClipRegion virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, diff --git a/vcl/inc/os2/salgdi.h b/vcl/inc/os2/salgdi.h index de95e5b2ec41..7a5c475adec0 100644 --- a/vcl/inc/os2/salgdi.h +++ b/vcl/inc/os2/salgdi.h @@ -166,7 +166,12 @@ protected: virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( + const ::basegfx::B2DPolygon&, + double fTransparency, + const ::basegfx::B2DVector& rLineWidth, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap); virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ); diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 7e9feaf80706..72720845a307 100755 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -119,7 +119,12 @@ protected: virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) = 0; virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) = 0; virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ) = 0; - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ) = 0; + virtual bool drawPolyLine( + const ::basegfx::B2DPolygon&, + double fTransparency, + const ::basegfx::B2DVector& rLineWidths, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap) = 0; virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) = 0; virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) = 0; virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ) = 0; @@ -361,7 +366,15 @@ public: PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ); bool DrawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency, const OutputDevice* ); - bool DrawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin, const OutputDevice* ); + + bool DrawPolyLine( + const basegfx::B2DPolygon& i_rPolygon, + double i_fTransparency, + const basegfx::B2DVector& i_rLineWidth, + basegfx::B2DLineJoin i_eLineJoin, + com::sun::star::drawing::LineCap i_eLineCap, + const OutputDevice* i_pOutDev); + sal_Bool DrawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, diff --git a/vcl/inc/unx/pspgraphics.h b/vcl/inc/unx/pspgraphics.h index a534611d0fa9..3323a6e85d0a 100644 --- a/vcl/inc/unx/pspgraphics.h +++ b/vcl/inc/unx/pspgraphics.h @@ -136,7 +136,12 @@ public: const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin); + virtual bool drawPolyLine( + const basegfx::B2DPolygon&, + double fTransparency, + const basegfx::B2DVector& rLineWidths, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap); virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index c69e4b0630c4..60a734be51b2 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -284,7 +284,12 @@ public: const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( + const ::basegfx::B2DPolygon&, + double fTransparency, + const ::basegfx::B2DVector& rLineWidth, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap); virtual bool drawFilledTrapezoids( const ::basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency ); #if 1 // TODO: remove these obselete methods diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx index 80ae55056a54..07a565857f9f 100644 --- a/vcl/inc/vcl/cvtsvm.hxx +++ b/vcl/inc/vcl/cvtsvm.hxx @@ -82,6 +82,9 @@ #define GDI_EXTENDEDPOLYGON_ACTION 1034 #define GDI_LINEDASHDOT_ACTION 1035 +// Added LineCap support +#define GDI_LINECAP_ACTION 1036 + // ---------------- // - SVMConverter - // ---------------- diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx index 6bf56af43258..13f2a9f2a19e 100644 --- a/vcl/inc/vcl/lineinfo.hxx +++ b/vcl/inc/vcl/lineinfo.hxx @@ -28,6 +28,7 @@ #include <tools/gen.hxx> #include <vcl/vclenum.hxx> #include <basegfx/vector/b2enums.hxx> +#include <com/sun/star/drawing/LineCap.hpp> // ---------------- // - ImplLineInfo - @@ -48,6 +49,7 @@ struct ImplLineInfo long mnDistance; basegfx::B2DLineJoin meLineJoin; + com::sun::star::drawing::LineCap meLineCap; ImplLineInfo(); ImplLineInfo( const ImplLineInfo& rImplLineInfo ); @@ -108,7 +110,10 @@ public: void SetLineJoin(basegfx::B2DLineJoin eLineJoin); basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; } - sal_Bool IsDefault() const { return( !mpImplLineInfo->mnWidth && ( LINE_SOLID == mpImplLineInfo->meStyle ) ); } + void SetLineCap(com::sun::star::drawing::LineCap eLineCap); + com::sun::star::drawing::LineCap GetLineCap() const { return mpImplLineInfo->meLineCap; } + + sal_Bool IsDefault() const; friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo ); friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo ); diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 30d8c0f3eaa0..8c4e9b2c3720 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -41,7 +41,7 @@ #include <com/sun/star/uno/Reference.h> #include <unotools/fontdefs.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> - +#include <com/sun/star/drawing/LineCap.hpp> #include <vector> struct ImplOutDevData; @@ -556,7 +556,11 @@ public: // #i101491# // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check. - SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, basegfx::B2DLineJoin eLineJoin); + SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect( + const basegfx::B2DPolygon& rB2DPolygon, + double fLineWidth = 0.0, + basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE, + com::sun::star::drawing::LineCap eLineCap = com::sun::star::drawing::LineCap_BUTT); // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area) void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon); @@ -687,7 +691,11 @@ public: @see DrawPolyPolygon */ void DrawPolyLine( const Polygon& rPoly ); - void DrawPolyLine( const basegfx::B2DPolygon&, double fLineWidth = 0.0, basegfx::B2DLineJoin = basegfx::B2DLINEJOIN_ROUND ); + void DrawPolyLine( + const basegfx::B2DPolygon&, + double fLineWidth = 0.0, + basegfx::B2DLineJoin = basegfx::B2DLINEJOIN_ROUND, + com::sun::star::drawing::LineCap = com::sun::star::drawing::LineCap_BUTT); /** Render the given polygon as a line stroke diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 755197147563..de0649a3b4ea 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -84,11 +84,6 @@ public: GDIMetaFile* GetGDIMetaFile() const { return mpMtf; } const JobSetup& GetJobSetup() const { return maJobSetup; } sal_Bool IsNewJobSetup() const { return (mbNewJobSetup != 0); } - - friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const PrinterPage& rPage ) - { rOStm << rPage.mbNewJobSetup; rOStm << rPage.maJobSetup; rPage.mpMtf->Write( rOStm ); return rOStm; } - friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, PrinterPage& rPage ) - { return rIStm >> rPage.mbNewJobSetup >> rPage.maJobSetup >> *rPage.mpMtf; } }; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 9227b2da7005..1ba1c51f36fb 100755 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -186,7 +186,12 @@ protected: virtual void drawPolygon( sal_uIntPtr nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( + const ::basegfx::B2DPolygon&, + double fTransparency, + const ::basegfx::B2DVector& rLineWidth, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap); virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 10e9971e08b1..414b0c51600f 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -599,6 +599,14 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } break; + case (GDI_LINECAP_ACTION) : + { + sal_Int16 nLineCap(0); + rIStm >> nLineCap; + aLineInfo.SetLineCap((com::sun::star::drawing::LineCap)nLineCap); + } + break; + case (GDI_LINEDASHDOT_ACTION) : { sal_Int16 a(0); @@ -1457,6 +1465,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, const LineInfo& rInfo = pAct->GetLineInfo(); const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle())); const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin()); + const bool bLineCap(bFatLine && com::sun::star::drawing::LineCap_BUTT != rInfo.GetLineCap()); const bool bLineDashDot(LINE_DASH == rInfo.GetStyle()); if( bFatLine ) @@ -1471,18 +1480,25 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << (sal_Int16) rInfo.GetLineJoin(); } - if(bLineDashDot) + if(bLineCap) { - rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION; - rOStm << (sal_Int32) 4 + 16; - rOStm << (sal_Int16)rInfo.GetDashCount(); - rOStm << (sal_Int32)rInfo.GetDashLen(); - rOStm << (sal_Int16)rInfo.GetDotCount(); - rOStm << (sal_Int32)rInfo.GetDotLen(); - rOStm << (sal_Int32)rInfo.GetDistance(); + rOStm << (sal_Int16) GDI_LINECAP_ACTION; + rOStm << (sal_Int32) 6; + rOStm << (sal_Int16) rInfo.GetLineCap(); } } + if(bLineDashDot) + { + rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION; + rOStm << (sal_Int32) 4 + 16; + rOStm << (sal_Int16)rInfo.GetDashCount(); + rOStm << (sal_Int32)rInfo.GetDashLen(); + rOStm << (sal_Int16)rInfo.GetDotCount(); + rOStm << (sal_Int32)rInfo.GetDotLen(); + rOStm << (sal_Int32)rInfo.GetDistance(); + } + rOStm << (sal_Int16) GDI_LINE_ACTION; rOStm << (sal_Int32) 20; rOStm << pAct->GetStartPoint(); @@ -1499,11 +1515,16 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, nCount += 1; } - if(bLineDashDot) + if(bLineCap) { nCount += 1; } } + + if(bLineDashDot) + { + nCount += 1; + } } break; @@ -1600,6 +1621,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, const sal_uInt16 nPoints(aSimplePoly.GetSize()); const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle())); const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin()); + const bool bLineCap(bFatLine && com::sun::star::drawing::LineCap_BUTT != rInfo.GetLineCap()); const bool bLineDashDot(LINE_DASH == rInfo.GetStyle()); if( bFatLine ) @@ -1613,6 +1635,13 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << (sal_Int32) 6; rOStm << (sal_Int16) rInfo.GetLineJoin(); } + + if(bLineCap) + { + rOStm << (sal_Int16) GDI_LINECAP_ACTION; + rOStm << (sal_Int32) 6; + rOStm << (sal_Int16) rInfo.GetLineCap(); + } } if(bLineDashDot) @@ -1652,6 +1681,11 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { nCount += 1; } + + if(bLineCap) + { + nCount += 1; + } } if(bLineDashDot) diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index 339b17792825..87c313c2e48c 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -47,7 +47,8 @@ ImplLineInfo::ImplLineInfo() : mnDotCount ( 0 ), mnDotLen ( 0 ), mnDistance ( 0 ), - meLineJoin ( basegfx::B2DLINEJOIN_ROUND ) + meLineJoin ( basegfx::B2DLINEJOIN_ROUND ), + meLineCap ( com::sun::star::drawing::LineCap_BUTT ) { } @@ -62,7 +63,8 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) : mnDotCount ( rImplLineInfo.mnDotCount ), mnDotLen ( rImplLineInfo.mnDotLen ), mnDistance ( rImplLineInfo.mnDistance ), - meLineJoin ( rImplLineInfo.meLineJoin ) + meLineJoin ( rImplLineInfo.meLineJoin ), + meLineCap ( rImplLineInfo.meLineCap ) { } @@ -77,7 +79,8 @@ inline bool ImplLineInfo::operator==( const ImplLineInfo& rB ) const && mnDotCount == rB.mnDotCount && mnDotLen == rB.mnDotLen && mnDistance == rB.mnDistance - && meLineJoin == rB.meLineJoin); + && meLineJoin == rB.meLineJoin + && meLineCap == rB.meLineCap); } // ------------ @@ -229,6 +232,28 @@ void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin) // ----------------------------------------------------------------------- +void LineInfo::SetLineCap(com::sun::star::drawing::LineCap eLineCap) +{ + DBG_CHKTHIS( LineInfo, NULL ); + + if(eLineCap != mpImplLineInfo->meLineCap) + { + ImplMakeUnique(); + mpImplLineInfo->meLineCap = eLineCap; + } +} + +// ----------------------------------------------------------------------- + +sal_Bool LineInfo::IsDefault() const +{ + return( !mpImplLineInfo->mnWidth + && ( LINE_SOLID == mpImplLineInfo->meStyle ) + && ( com::sun::star::drawing::LineCap_BUTT == mpImplLineInfo->meLineCap)); +} + +// ----------------------------------------------------------------------- + SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) { VersionCompat aCompat( rIStm, STREAM_READ ); @@ -251,6 +276,12 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16; } + if( aCompat.GetVersion() >= 4 ) + { + // version 4 + rIStm >> nTmp16; rImplLineInfo.meLineCap = (com::sun::star::drawing::LineCap) nTmp16; + } + return rIStm; } @@ -258,7 +289,7 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) { - VersionCompat aCompat( rOStm, STREAM_WRITE, 3 ); + VersionCompat aCompat( rOStm, STREAM_WRITE, 4 ); // version 1 rOStm << (sal_uInt16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth; @@ -271,6 +302,9 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) // since version3 rOStm << (sal_uInt16) rImplLineInfo.meLineJoin; + // since version4 + rOStm << (sal_uInt16) rImplLineInfo.meLineCap; + return rOStm; } @@ -354,7 +388,8 @@ void LineInfo::applyToB2DPolyPolygon( o_rFillPolyPolygon.append(basegfx::tools::createAreaGeometry( io_rLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, - GetLineJoin())); + GetLineJoin(), + GetLineCap())); } io_rLinePolyPolygon.clear(); diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 6a57320c763c..48f4195cbb54 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -1509,7 +1509,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine); } - if( mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this)) + if( mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, com::sun::star::drawing::LineCap_BUTT, this)) { return; } @@ -1596,7 +1596,8 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand( aFillPolyPolygon.append(basegfx::tools::createAreaGeometry( aLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, - rInfo.GetLineJoin())); + rInfo.GetLineJoin(), + rInfo.GetLineCap())); } aLinePolyPolygon.clear(); @@ -1614,7 +1615,7 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand( if(bTryAA) { - bDone = mpGraphics->DrawPolyLine( aCandidate, 0.0, basegfx::B2DVector(1.0,1.0), basegfx::B2DLINEJOIN_NONE, this); + bDone = mpGraphics->DrawPolyLine( aCandidate, 0.0, basegfx::B2DVector(1.0,1.0), basegfx::B2DLINEJOIN_NONE, com::sun::star::drawing::LineCap_BUTT, this); } if(!bDone) @@ -1646,7 +1647,10 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand( { for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) { - const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + + // need to subdivide, mpGraphics->DrawPolygon ignores curves + aPolygon.AdaptiveSubdivide(aPolygon); mpGraphics->DrawPolygon(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this); } } @@ -1789,7 +1793,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) && IsLineColor()); // use b2dpolygon drawing if possible - if(bTryAA && ImpTryDrawPolyLineDirect(rPoly.getB2DPolygon(), 0.0, basegfx::B2DLINEJOIN_NONE)) + if(bTryAA && ImpTryDrawPolyLineDirect(rPoly.getB2DPolygon())) { basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon()); const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); @@ -1803,7 +1807,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine); } - if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this)) + if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, com::sun::star::drawing::LineCap_BUTT, this)) { return; } @@ -1851,7 +1855,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(), rLineInfo.GetLineJoin()); + DrawPolyLine( rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin(), rLineInfo.GetLineCap()); return; } @@ -1983,7 +1987,13 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) aB2DPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolygon); } - bSuccess = mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); + bSuccess = mpGraphics->DrawPolyLine( + aB2DPolygon, + 0.0, + aB2DLineWidth, + basegfx::B2DLINEJOIN_NONE, + com::sun::star::drawing::LineCap_BUTT, + this); } if(bSuccess) @@ -2075,7 +2085,13 @@ void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) for(sal_uInt32 a(0); bSuccess && a < aB2DPolyPolygon.count(); a++) { - bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); + bSuccess = mpGraphics->DrawPolyLine( + aB2DPolyPolygon.getB2DPolygon(a), + 0.0, + aB2DLineWidth, + basegfx::B2DLINEJOIN_NONE, + com::sun::star::drawing::LineCap_BUTT, + this); } } @@ -2198,7 +2214,13 @@ void OutputDevice::ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPo for(sal_uInt32 a(0);bSuccess && a < aB2DPolyPolygon.count(); a++) { - bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); + bSuccess = mpGraphics->DrawPolyLine( + aB2DPolyPolygon.getB2DPolygon(a), + 0.0, + aB2DLineWidth, + basegfx::B2DLINEJOIN_NONE, + com::sun::star::drawing::LineCap_BUTT, + this); } } @@ -2219,7 +2241,8 @@ void OutputDevice::ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPo bool OutputDevice::ImpTryDrawPolyLineDirect( const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, - basegfx::B2DLineJoin eLineJoin) + basegfx::B2DLineJoin eLineJoin, + com::sun::star::drawing::LineCap eLineCap) { const basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); basegfx::B2DVector aB2DLineWidth(1.0, 1.0); @@ -2245,17 +2268,25 @@ bool OutputDevice::ImpTryDrawPolyLineDirect( } // draw the polyline - return mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, eLineJoin, this); + return mpGraphics->DrawPolyLine( + aB2DPolygon, + 0.0, + aB2DLineWidth, + eLineJoin, + eLineCap, + this); } void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, - basegfx::B2DLineJoin eLineJoin) + basegfx::B2DLineJoin eLineJoin, + com::sun::star::drawing::LineCap eLineCap) { DBG_TRACE( "OutputDevice::DrawPolyLine(B2D&)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); (void)eLineJoin; // ATM used in UNX, but not in WNT, access it for warning-free + (void)eLineCap; #if 0 // MetaB2DPolyLineAction is not implemented yet: // according to AW adding it is very dangerous since there is a lot @@ -2297,7 +2328,7 @@ void OutputDevice::DrawPolyLine( && IsLineColor()); // use b2dpolygon drawing if possible - if(bTryAA && ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, eLineJoin)) + if(bTryAA && ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, eLineJoin, eLineCap)) { return; } @@ -2311,9 +2342,12 @@ void OutputDevice::DrawPolyLine( && rB2DPolygon.count() <= 1000) { const double fHalfLineWidth((fLineWidth * 0.5) + 0.5); - const basegfx::B2DPolyPolygon aAreaPolyPolygon(basegfx::tools::createAreaGeometry( - rB2DPolygon, fHalfLineWidth, eLineJoin)); - + const basegfx::B2DPolyPolygon aAreaPolyPolygon( + basegfx::tools::createAreaGeometry( + rB2DPolygon, + fHalfLineWidth, + eLineJoin, + eLineCap)); const Color aOldLineColor(maLineColor); const Color aOldFillColor(maFillColor); @@ -2340,7 +2374,7 @@ void OutputDevice::DrawPolyLine( // to avoid optical gaps for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++) { - ImpTryDrawPolyLineDirect(aAreaPolyPolygon.getB2DPolygon(a), 0.0, basegfx::B2DLINEJOIN_NONE); + ImpTryDrawPolyLineDirect(aAreaPolyPolygon.getB2DPolygon(a)); } } } diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index f4b4dee908c6..626c0989db1e 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -200,7 +200,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolygon aOnePoly = aB2DPolyPolygon.getB2DPolygon( nPolyIdx ); - mpGraphics->DrawPolyLine( aOnePoly, fTransparency, aHairlineWidth, ::basegfx::B2DLINEJOIN_NONE, this ); + mpGraphics->DrawPolyLine( aOnePoly, fTransparency, aHairlineWidth, ::basegfx::B2DLINEJOIN_NONE, com::sun::star::drawing::LineCap_BUTT, this ); } } @@ -317,7 +317,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolygon& rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx ); - bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this ); + bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, com::sun::star::drawing::LineCap_BUTT, this ); } // prepare to restore the fill color mbInitFillColor = mbFillColor; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 896d322185cb..8655cf126588 100755 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1624,7 +1624,28 @@ void PDFWriterImpl::PDFPage::appendMappedLength( double fLength, OStringBuffer& bool PDFWriterImpl::PDFPage::appendLineInfo( const LineInfo& rInfo, OStringBuffer& rBuffer ) const { - bool bRet = true; + if(LINE_DASH == rInfo.GetStyle() && rInfo.GetDashLen() != rInfo.GetDotLen()) + { + // dashed and non-degraded case, check for implementation limits of dash array + // in PDF reader apps (e.g. acroread) + if(2 * (rInfo.GetDashCount() + rInfo.GetDotCount()) > 10) + { + return false; + } + } + + if(basegfx::B2DLINEJOIN_NONE != rInfo.GetLineJoin()) + { + // LineJoin used, ExtLineInfo required + return false; + } + + if(com::sun::star::drawing::LineCap_BUTT != rInfo.GetLineCap()) + { + // LineCap used, ExtLineInfo required + return false; + } + if( rInfo.GetStyle() == LINE_DASH ) { rBuffer.append( "[ " ); @@ -1637,10 +1658,6 @@ bool PDFWriterImpl::PDFPage::appendLineInfo( const LineInfo& rInfo, OStringBuffe } else { - // check for implementation limits of dash array - // in PDF reader apps (e.g. acroread) - if( 2*(rInfo.GetDashCount() + rInfo.GetDotCount()) > 10 ) - bRet = false; for( int n = 0; n < rInfo.GetDashCount(); n++ ) { appendMappedLength( (sal_Int32)rInfo.GetDashLen(), rBuffer ); @@ -1658,6 +1675,7 @@ bool PDFWriterImpl::PDFPage::appendLineInfo( const LineInfo& rInfo, OStringBuffe } rBuffer.append( "] 0 d\n" ); } + if( rInfo.GetWidth() > 1 ) { appendMappedLength( (sal_Int32)rInfo.GetWidth(), rBuffer ); @@ -1669,7 +1687,8 @@ bool PDFWriterImpl::PDFPage::appendLineInfo( const LineInfo& rInfo, OStringBuffe appendDouble( 72.0/double(m_pWriter->getReferenceDevice()->ImplGetDPIX()), rBuffer ); rBuffer.append( " w\n" ); } - return bRet; + + return true; } void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal_Int32 nDelta, OStringBuffer& rBuffer ) const @@ -9045,21 +9064,68 @@ void PDFWriterImpl::convertLineInfoToExtLineInfo( const LineInfo& rIn, PDFWriter rOut.m_fMiterLimit = 10; rOut.m_aDashArray.clear(); - int nDashes = rIn.GetDashCount(); - int nDashLen = rIn.GetDashLen(); - int nDistance = rIn.GetDistance(); + // add DashDot to DashArray + const int nDashes = rIn.GetDashCount(); + const int nDashLen = rIn.GetDashLen(); + const int nDistance = rIn.GetDistance(); + for( int n = 0; n < nDashes; n++ ) { rOut.m_aDashArray.push_back( nDashLen ); rOut.m_aDashArray.push_back( nDistance ); } - int nDots = rIn.GetDotCount(); - int nDotLen = rIn.GetDotLen(); + + const int nDots = rIn.GetDotCount(); + const int nDotLen = rIn.GetDotLen(); + for( int n = 0; n < nDots; n++ ) { rOut.m_aDashArray.push_back( nDotLen ); rOut.m_aDashArray.push_back( nDistance ); } + + // add LineJoin + switch(rIn.GetLineJoin()) + { + case basegfx::B2DLINEJOIN_BEVEL : + { + rOut.m_eJoin = PDFWriter::joinBevel; + break; + } + default : // basegfx::B2DLINEJOIN_NONE : + // Pdf has no 'none' lineJoin, default is miter + case basegfx::B2DLINEJOIN_MIDDLE : + case basegfx::B2DLINEJOIN_MITER : + { + rOut.m_eJoin = PDFWriter::joinMiter; + break; + } + case basegfx::B2DLINEJOIN_ROUND : + { + rOut.m_eJoin = PDFWriter::joinRound; + break; + } + } + + // add LineCap + switch(rIn.GetLineCap()) + { + default: /* com::sun::star::drawing::LineCap_BUTT */ + { + rOut.m_eCap = PDFWriter::capButt; + break; + } + case com::sun::star::drawing::LineCap_ROUND: + { + rOut.m_eCap = PDFWriter::capRound; + break; + } + case com::sun::star::drawing::LineCap_SQUARE: + { + rOut.m_eCap = PDFWriter::capSquare; + break; + } + } } void PDFWriterImpl::drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLineInfo& rInfo ) diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 094acf76cb92..416d97558c32 100755 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -412,7 +412,8 @@ bool SalGraphics::drawPolyLine( const basegfx::B2DPolygon& /*rPolyPolygon*/, double /*fTransparency*/, const basegfx::B2DVector& /*rLineWidths*/, - basegfx::B2DLineJoin /*eLineJoin*/) + basegfx::B2DLineJoin /*eLineJoin*/, + com::sun::star::drawing::LineCap /*eLineCap*/) { return false; } @@ -542,18 +543,22 @@ sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt3 return bRet; } -bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double fTransparency, - const ::basegfx::B2DVector& i_rLineWidth, basegfx::B2DLineJoin i_eLineJoin, +bool SalGraphics::DrawPolyLine( + const ::basegfx::B2DPolygon& i_rPolygon, + double i_fTransparency, + const ::basegfx::B2DVector& i_rLineWidth, + basegfx::B2DLineJoin i_eLineJoin, + com::sun::star::drawing::LineCap i_eLineCap, const OutputDevice* i_pOutDev ) { bool bRet = false; if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) ); - bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin ); + bRet = drawPolyLine( aMirror, i_fTransparency, i_rLineWidth, i_eLineJoin, i_eLineCap ); } else - bRet = drawPolyLine( i_rPolygon, fTransparency, i_rLineWidth, i_eLineJoin ); + bRet = drawPolyLine( i_rPolygon, i_fTransparency, i_rLineWidth, i_eLineJoin, i_eLineCap ); return bRet; } diff --git a/vcl/unx/generic/gdi/pspgraphics.cxx b/vcl/unx/generic/gdi/pspgraphics.cxx index d2a1942f419a..188cff6be9dd 100644 --- a/vcl/unx/generic/gdi/pspgraphics.cxx +++ b/vcl/unx/generic/gdi/pspgraphics.cxx @@ -401,7 +401,12 @@ bool PspGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fT return false; } -bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, double /*fTranspareny*/, const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/) +bool PspGraphics::drawPolyLine( + const basegfx::B2DPolygon&, + double /*fTranspareny*/, + const basegfx::B2DVector& /*rLineWidths*/, + basegfx::B2DLineJoin /*eJoin*/, + com::sun::star::drawing::LineCap /*eLineCap*/) { // TODO: a PS printer can draw B2DPolyLines almost directly return false; diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 79b2a1b1319f..d7a3eccb0d09 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -1186,7 +1186,12 @@ bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTr // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin) +bool X11SalGraphics::drawPolyLine( + const ::basegfx::B2DPolygon& rPolygon, + double fTransparency, + const ::basegfx::B2DVector& rLineWidth, + basegfx::B2DLineJoin eLineJoin, + com::sun::star::drawing::LineCap eLineCap) { const bool bIsHairline = (rLineWidth.getX() == rLineWidth.getY()) && (rLineWidth.getX() <= 1.2); @@ -1240,7 +1245,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double } // create the area-polygon for the line - const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, fHalfWidth, eLineJoin) ); + const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, fHalfWidth, eLineJoin, eLineCap) ); if( (rLineWidth.getX() != rLineWidth.getY()) && !basegfx::fTools::equalZero( rLineWidth.getX() ) ) diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 45cb3214ab7e..c3f4ce549e1e 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -372,7 +372,12 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, dbgOut( m_aDevice ); } -bool SvpSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ ) +bool SvpSalGraphics::drawPolyLine( + const ::basegfx::B2DPolygon&, + double /*fTransparency*/, + const ::basegfx::B2DVector& /*rLineWidths*/, + basegfx::B2DLineJoin /*eJoin*/, + com::sun::star::drawing::LineCap /*eLineCap*/) { // TODO: implement and advertise OutDevSupport_B2DDraw support return false; diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index 93d821ea228a..f36e72aa4c19 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -115,7 +115,12 @@ public: virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( + const ::basegfx::B2DPolygon&, + double fTransparency, + const ::basegfx::B2DVector& rLineWidths, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap); virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ); virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 93c22878f775..281f8c57b53a 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -320,7 +320,12 @@ void PspGraphics::drawPolyPolygon( sal_uInt32 nPoly, m_pPrinterGfx->DrawPolyPolygon (nPoly, pPoints, (const Point**)pPtAry); } -bool PspGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ ) +bool PspGraphics::drawPolyLine( + const ::basegfx::B2DPolygon&, + double /*fTransparency*/, + const ::basegfx::B2DVector& /*rLineWidths*/, + basegfx::B2DLineJoin /*eJoin*/, + com::sun::star::drawing::LineCap /*eLineCap*/) { // TODO: implement and advertise OutDevSupport_B2DDraw support return false; diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index ba2ff841eee6..f8a4d182f369 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -136,7 +136,12 @@ public: virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ); virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( + const ::basegfx::B2DPolygon&, + double fTransparency, + const ::basegfx::B2DVector& rLineWidths, + basegfx::B2DLineJoin, + com::sun::star::drawing::LineCap); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index f8430d25bc5d..6fc73b86d02c 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -187,7 +187,12 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly return true; } -bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin ) +bool WinSalGraphics::drawPolyLine( + const basegfx::B2DPolygon& rPolygon, + double fTransparency, + const basegfx::B2DVector& rLineWidths, + basegfx::B2DLineJoin eLineJoin, + com::sun::star::drawing::LineCap eLineCap) { const sal_uInt32 nCount(rPolygon.count()); @@ -230,6 +235,27 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f } } + switch(eLineCap) + { + default: /*com::sun::star::drawing::LineCap_BUTT*/ + { + // nothing to do + break; + } + case com::sun::star::drawing::LineCap_ROUND: + { + aTestPen.SetStartCap(Gdiplus::LineCapRound); + aTestPen.SetEndCap(Gdiplus::LineCapRound); + break; + } + case com::sun::star::drawing::LineCap_SQUARE: + { + aTestPen.SetStartCap(Gdiplus::LineCapSquare); + aTestPen.SetEndCap(Gdiplus::LineCapSquare); + break; + } + } + if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5)) { impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin); |