summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-08-28 19:32:35 +0900
committerMichael Meeks <michael.meeks@collabora.com>2015-08-28 15:11:16 +0000
commit394387490ad4f8e52deeb2f32d7f83042b3eded1 (patch)
tree55da4639efdc907f52ce1a8254f753da7050f33f
parent7f0c71d06236d822e3496cabbcfcde97e0d2e7d0 (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 (cherry picked from commit c9d39c37b2c186e2b9d9841b18ecc6aed4684f62) Reviewed-on: https://gerrit.libreoffice.org/18105 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-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 f5b746e5db1e..266f61e239bb 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1418,27 +1418,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;
}