diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2015-01-08 18:09:49 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-01-13 16:03:28 +0000 |
commit | c54196932b744c0b7d2cb236724582c93eff4c77 (patch) | |
tree | ae46332a95a63ede2b0ee26664dd2d21e42d1822 | |
parent | 1184218611d1b1b28f0b10879e91388e261b1c24 (diff) |
implement optimized hairline drawing for opengl
private/mmeeks/aafixes-4-4private/mmeeks/aafixes44
As a side effect, this prevents the lines from looking too wide,
because of generic polygon drawing being a bit too generous with AA.
Change-Id: I17314c39fd57e33ecbd10b8a8785c600bdc5b212
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 07a7cd7cff2b..6c565faf58f4 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -1219,17 +1219,19 @@ bool OpenGLSalGraphicsImpl::drawPolyLine( //bool bDrawnOk = true; if( bIsHairline ) { - // hairlines can benefit from a simplified tesselation - // e.g. for hairlines the linejoin style can be ignored - /*basegfx::B2DTrapezoidVector aB2DTrapVector; - basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, aPolygon, rLineWidth.getX() ); - - // draw tesselation result - const int nTrapCount = aB2DTrapVector.size(); - if( nTrapCount > 0 ) - bDrawnOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency ); - - return bDrawnOk;*/ + // hairlines can be drawn in a simpler way (the linejoin and linecap styles can be ignored) + PreDraw(); + if( UseSolidAA( mnLineColor, fTransparency )) + { + for( sal_uInt32 j = 0; j < rPolygon.count() - 1; j++ ) + { + const ::basegfx::B2DPoint& rPt1( rPolygon.getB2DPoint( j ) ); + const ::basegfx::B2DPoint& rPt2( rPolygon.getB2DPoint(( j + 1 )) ); + DrawLineAA( rPt1.getX(), rPt1.getY(), rPt2.getX(), rPt2.getY()); + } + } + PostDraw(); + return true; } // get the area polygon for the line polygon |