summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2016-02-24 00:44:58 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-29 09:41:17 +0000
commit334288af53e15f4b16f520a48e84e84c6980b8c7 (patch)
treeff281ab3bc0ded1e69503719a118b59bc2cadea8 /basegfx
parent0f571cf2781d98a1897952aa53329ebb3716dc19 (diff)
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. (cherry picked from commit d18ad8a7fb3257001a5045e11f3f770a48a7fa69) Change-Id: If7982c828cae1fae59c57194c8ac77e5ad7f1d26 Reviewed-on: https://gerrit.libreoffice.org/22706 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dlinegeometry.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index c259fef49504..a3095caa05f0 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,