[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/opengl
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Mon Aug 8 11:33:20 UTC 2016
vcl/opengl/gdiimpl.cxx | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
New commits:
commit 09fe869bf8ef14a6011317c8c494067c09951820
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat Aug 6 14:27:55 2016 +0900
tdf#100915 draw antialiased line just for polygon outline
To get the anti-aliased polygon we draw a anti-aliased line around
every trapezoid. This works fine until we draw a transparent
polygon where the lines become visible because of blending. A much
better and faster way is to just draw the polygon outline with
anti-aliased lines. This is done with this commit.
Same fix as aeb0c407a620ea8c28903f61d9d53e6d9ae7c53a in master,
but the code differs in 5.2 from master so much that it is generally
a separate implementation.
Change-Id: I95f98cc930caa7138a59048af68d4015046334d4
Reviewed-on: https://gerrit.libreoffice.org/27923
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index b96ee67..4f1da07 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1142,14 +1142,13 @@ void OpenGLSalGraphicsImpl::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPt
void OpenGLSalGraphicsImpl::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, bool blockAA )
{
- const basegfx::B2DPolyPolygon& aSimplePolyPolygon = ::basegfx::tools::solveCrossovers( rPolyPolygon );
basegfx::B2DTrapezoidVector aB2DTrapVector;
- basegfx::tools::trapezoidSubdivide( aB2DTrapVector, aSimplePolyPolygon );
+ basegfx::tools::trapezoidSubdivide(aB2DTrapVector, rPolyPolygon);
// draw tesselation result
- if( aB2DTrapVector.size())
+ if (aB2DTrapVector.size())
{
- for(basegfx::B2DTrapezoid & i : aB2DTrapVector)
- DrawTrapezoid( i, blockAA );
+ for(basegfx::B2DTrapezoid & rTrapezoid : aB2DTrapVector)
+ DrawTrapezoid(rTrapezoid, blockAA);
}
}
@@ -1838,20 +1837,32 @@ void OpenGLSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32*
bool OpenGLSalGraphicsImpl::drawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency )
{
VCL_GL_INFO( "::drawPolyPolygon trans " << fTransparency );
+
if( rPolyPolygon.count() <= 0 )
return true;
- PreDraw( XOROption::IMPLEMENT_XOR );
+ bool bUseAA = mrParent.getAntiAliasB2DDraw();
- if( UseSolid( mnFillColor, fTransparency ) )
- DrawPolyPolygon( rPolyPolygon );
+ PreDraw(XOROption::IMPLEMENT_XOR);
+
+ if (mnFillColor != SALCOLOR_NONE && UseSolid(mnFillColor, fTransparency))
+ {
+ DrawPolyPolygon(rPolyPolygon, true);
+ }
- if( mnLineColor != mnFillColor && UseSolid( mnLineColor, fTransparency ))
+ if (mnLineColor != SALCOLOR_NONE || bUseAA)
{
- basegfx::B2DTrapezoidVector aB2DTrapVector;
- basegfx::tools::createLineTrapezoidFromB2DPolyPolygon( aB2DTrapVector, rPolyPolygon );
- for(basegfx::B2DTrapezoid & i : aB2DTrapVector)
- DrawTrapezoid( i );
+ SalColor nColor = (mnLineColor == SALCOLOR_NONE) ? mnFillColor : mnLineColor;
+ if (UseLine(nColor, fTransparency, 1.0, bUseAA))
+ {
+ for (const basegfx::B2DPolygon& rPolygon : rPolyPolygon)
+ {
+ basegfx::B2DPolygon aPolygon(rPolygon);
+ if (rPolygon.areControlPointsUsed())
+ aPolygon = rPolygon.getDefaultAdaptiveSubdivision();
+ DrawPolyLine(aPolygon, 1.0f, basegfx::B2DLineJoin::NONE, css::drawing::LineCap_BUTT, float(15.0 * F_PI180));
+ }
+ }
}
PostDraw();
More information about the Libreoffice-commits
mailing list