diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2016-02-24 00:44:58 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2016-02-25 11:16:19 +0100 |
commit | d18ad8a7fb3257001a5045e11f3f770a48a7fa69 (patch) | |
tree | db0d594bd7c1c4e2c458913b24a0978b7d4951d7 /basegfx | |
parent | turn unuseddefaultparams plugin off by default (diff) | |
download | core-d18ad8a7fb3257001a5045e11f3f770a48a7fa69.tar.gz core-d18ad8a7fb3257001a5045e11f3f770a48a7fa69.zip |
opengl: shader based polyline rendering - fixes tdf#97137 for OGL
Adds native opengl polyline rendering to draw polylines, line joins
and line caps as triangle strips. The vertex shader allows for the
dynamic line width by calculating the correct vertex posiitons,
and the fragment shader is used for anti-aliasing.
Change-Id: If7982c828cae1fae59c57194c8ac77e5ad7f1d26
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dlinegeometry.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 5527dd0d0a0f..33dd5707a4fb 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -779,6 +779,35 @@ namespace basegfx namespace tools { + B2DPolygon polygonSubdivide(const B2DPolygon& rCandidate, double fMaxAllowedAngle, double fMaxPartOfEdge) + { + if(fMaxAllowedAngle > F_PI2) + { + fMaxAllowedAngle = F_PI2; + } + else if(fMaxAllowedAngle < 0.01 * F_PI2) + { + fMaxAllowedAngle = 0.01 * F_PI2; + } + + if(fMaxPartOfEdge > 1.0) + { + fMaxPartOfEdge = 1.0; + } + else if(fMaxPartOfEdge < 0.01) + { + fMaxPartOfEdge = 0.01; + } + + B2DPolygon aCandidate(rCandidate); + const double fMaxCos(cos(fMaxAllowedAngle)); + + aCandidate.removeDoublePoints(); + aCandidate = subdivideToSimple(aCandidate, fMaxCos * fMaxCos, fMaxPartOfEdge * fMaxPartOfEdge); + + return aCandidate; + } + B2DPolyPolygon createAreaGeometry( const B2DPolygon& rCandidate, double fHalfLineWidth, |