diff options
author | Armin Le Grand <alg@apache.org> | 2013-05-10 08:48:11 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-19 09:23:28 +0100 |
commit | 02da9f7a917ffc68dfe7a44c8d03b272cb5bfc18 (patch) | |
tree | 017bc3354966e7e2d64266e2fec6dd0ce1ed3c09 /vcl/source/gdi/outdev.cxx | |
parent | 5e5f3671f8448ee21b00f0d2a08b214e61f7f744 (diff) |
Resolves: #i110384# added better fat line rendering where possible
(cherry picked from commit 144eb666b72516ef78c15424087800dff1be5cfd)
Conflicts:
drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx
drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
vcl/inc/vcl/outdev.hxx
Change-Id: I89f378a4d7a8311b8922f10acff66b000a20a4b7
Diffstat (limited to 'vcl/source/gdi/outdev.cxx')
-rw-r--r-- | vcl/source/gdi/outdev.cxx | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 4c3f73a0543e..23a79d4e4ba9 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -2148,6 +2148,7 @@ void OutputDevice::ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPo bool OutputDevice::ImpTryDrawPolyLineDirect( const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, + double fTransparency, basegfx::B2DLineJoin eLineJoin, com::sun::star::drawing::LineCap eLineCap) { @@ -2177,13 +2178,64 @@ bool OutputDevice::ImpTryDrawPolyLineDirect( // draw the polyline return mpGraphics->DrawPolyLine( aB2DPolygon, - 0.0, + fTransparency, aB2DLineWidth, eLineJoin, eLineCap, this); } +bool OutputDevice::TryDrawPolyLineDirect( + const basegfx::B2DPolygon& rB2DPolygon, + double fLineWidth, + double fTransparency, + basegfx::B2DLineJoin eLineJoin, + com::sun::star::drawing::LineCap eLineCap) +{ + // AW: Do NOT paint empty PolyPolygons + if(!rB2DPolygon.count()) + return true; + + // we need a graphics + if( !mpGraphics ) + if( !ImplGetGraphics() ) + return false; + + if( mbInitClipRegion ) + ImplInitClipRegion(); + + if( mbOutputClipped ) + return true; + + if( mbInitLineColor ) + ImplInitLineColor(); + + const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) + && mpGraphics->supportsOperation(OutDevSupport_B2DDraw) + && ROP_OVERPAINT == GetRasterOp() + && IsLineColor()); + + if(bTryAA) + { + if(ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, fTransparency, eLineJoin, eLineCap)) + { + // worked, add metafile action (if recorded) and return true + if( mpMetaFile ) + { + LineInfo aLineInfo; + if( fLineWidth != 0.0 ) + aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) ); + const Polygon aToolsPolygon( rB2DPolygon ); + mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) ); + } + + return true; + } + } + + return false; +} + void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, @@ -2191,8 +2243,6 @@ void OutputDevice::DrawPolyLine( com::sun::star::drawing::LineCap eLineCap) { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - (void)eLineJoin; // ATM used in UNX, but not in WNT, access it for warning-free - (void)eLineCap; if( mpMetaFile ) { @@ -2226,7 +2276,7 @@ void OutputDevice::DrawPolyLine( && IsLineColor()); // use b2dpolygon drawing if possible - if(bTryAA && ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, eLineJoin, eLineCap)) + if(bTryAA && ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, 0.0, eLineJoin, eLineCap)) { return; } |