Kaydet (Commit) c9d39c37 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

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
üst ca257c35
...@@ -1415,27 +1415,31 @@ bool OpenGLSalGraphicsImpl::drawPolyLine( ...@@ -1415,27 +1415,31 @@ bool OpenGLSalGraphicsImpl::drawPolyLine(
basegfx::B2DPolygon aPolygon = rPolygon; basegfx::B2DPolygon aPolygon = rPolygon;
const double fHalfWidth = 0.5 * rLineWidth.getX(); 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 // shortcut for hairline drawing to improve performance
//bool bDrawnOk = true;
if( bIsHairline ) if( bIsHairline )
{ {
PreDraw(); basegfx::B2DTrapezoidVector aTrapezVector;
if( UseSolidAA( mnLineColor ) ) basegfx::tools::createLineTrapezoidFromB2DPolygon(aTrapezVector, aPolygon, rLineWidth.getX());
if (aTrapezVector.size())
{ {
sal_uInt32 nPoints = rPolygon.count(); PreDraw();
for (sal_uInt32 i = 0; i < nPoints - 1; ++i) if (UseSolidAA(mnLineColor, fTransparency))
{ {
const basegfx::B2DPoint& rPt1 = rPolygon.getB2DPoint(i); for (size_t i = 0; i < aTrapezVector.size(); ++i)
const basegfx::B2DPoint& rPt2 = rPolygon.getB2DPoint(i+1); {
DrawLineAA(rPt1.getX(), rPt1.getY(), const basegfx::B2DPolygon& rTrapezPolygon = aTrapezVector[i].getB2DPolygon();
rPt2.getX(), rPt2.getY()); 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; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment