summaryrefslogtreecommitdiff
path: root/vcl/opengl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-08-28 19:32:35 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-08-28 20:08:05 +0900
commitc9d39c37b2c186e2b9d9841b18ecc6aed4684f62 (patch)
tree73c2328ab65e603756966df34c4b6411de6a63d8 /vcl/opengl
parentca257c35e3c80a6b80332fc062444f24f115d1f0 (diff)
tdf#93736 need to create trapezoid from input polygon
Currently we draw the polyline from the input polygon, but we should first create a trapezoid and draw its polygons when drawing the hairline. Change-Id: Idd850d18d05410c75a8a2c922338caf46158bfd4
Diffstat (limited to 'vcl/opengl')
-rw-r--r--vcl/opengl/gdiimpl.cxx32
1 files changed, 18 insertions, 14 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 286fa7f53984..97f2547be3bf 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1415,27 +1415,31 @@ bool OpenGLSalGraphicsImpl::drawPolyLine(
basegfx::B2DPolygon aPolygon = rPolygon;
const double fHalfWidth = 0.5 * rLineWidth.getX();
- // #i122456# This is probably thought to happen to align hairlines to pixel positions, so
- // it should be a 0.5 translation, not more. It will definitely go wrong with fat lines
- aPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.5) );
-
// shortcut for hairline drawing to improve performance
- //bool bDrawnOk = true;
if( bIsHairline )
{
- PreDraw();
- if( UseSolidAA( mnLineColor ) )
+ basegfx::B2DTrapezoidVector aTrapezVector;
+ basegfx::tools::createLineTrapezoidFromB2DPolygon(aTrapezVector, aPolygon, rLineWidth.getX());
+ if (aTrapezVector.size())
{
- sal_uInt32 nPoints = rPolygon.count();
- for (sal_uInt32 i = 0; i < nPoints - 1; ++i)
+ PreDraw();
+ if (UseSolidAA(mnLineColor, fTransparency))
{
- const basegfx::B2DPoint& rPt1 = rPolygon.getB2DPoint(i);
- const basegfx::B2DPoint& rPt2 = rPolygon.getB2DPoint(i+1);
- DrawLineAA(rPt1.getX(), rPt1.getY(),
- rPt2.getX(), rPt2.getY());
+ for (size_t i = 0; i < aTrapezVector.size(); ++i)
+ {
+ const basegfx::B2DPolygon& rTrapezPolygon = aTrapezVector[i].getB2DPolygon();
+ sal_uInt32 nPoints = rTrapezPolygon.count();
+ for (sal_uInt32 j = 0; j < nPoints - 1; ++j)
+ {
+ const basegfx::B2DPoint& rPoint1 = rTrapezPolygon.getB2DPoint(j);
+ const basegfx::B2DPoint& rPoint2 = rTrapezPolygon.getB2DPoint(j + 1);
+ DrawLineAA(rPoint1.getX(), rPoint1.getY(),
+ rPoint2.getX(), rPoint2.getY());
+ }
+ }
}
+ PostDraw();
}
- PostDraw();
return true;
}