[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - basegfx/source include/basegfx vcl/opengl

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed May 25 15:36:07 UTC 2016


 basegfx/source/polygon/b2dlinegeometry.cxx  |   29 ----------------------------
 basegfx/source/polygon/b2dpolygon.cxx       |    2 -
 include/basegfx/polygon/b2dlinegeometry.hxx |    5 ----
 vcl/opengl/gdiimpl.cxx                      |    4 ---
 4 files changed, 2 insertions(+), 38 deletions(-)

New commits:
commit ee3bc82d071fc8a7d835399f33c07320f87992ec
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon May 16 22:25:15 2016 +0900

    tdf#99130 use subdivision on B2DPolygon, angle based subdivision
    
    Remove the subdivider we used until now as there is a better
    way to subdivide a polygon with getDefaultAdaptiveSubdivision,
    which in additiona also caches the result. The subdivider used in
    getDefaultAdaptiveSubdivision was a limited count based subdivider
    so this exchanges that with an angle based one which gives much
    better results.
    
    Reviewed-on: https://gerrit.libreoffice.org/25033
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    (cherry picked from commit 37ed508022e0be8b793caa4748cfee634c1c8a9c)
    
    Change-Id: I95c009ccf3d54305df0d8eef177cab0df0a23bea
    Reviewed-on: https://gerrit.libreoffice.org/25381
    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/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index a3095ca..c259fef 100644
--- a/basegfx/source/polygon/b2dlinegeometry.cxx
+++ b/basegfx/source/polygon/b2dlinegeometry.cxx
@@ -779,35 +779,6 @@ 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,
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index f46c377..5ad06ea 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -483,7 +483,7 @@ public:
     {
         if(!mpDefaultSubdivision)
         {
-            const_cast< ImplBufferedData* >(this)->mpDefaultSubdivision.reset(new basegfx::B2DPolygon(basegfx::tools::adaptiveSubdivideByCount(rSource, 9)));
+            const_cast< ImplBufferedData* >(this)->mpDefaultSubdivision.reset(new basegfx::B2DPolygon(basegfx::tools::adaptiveSubdivideByAngle(rSource)));
         }
 
         return *mpDefaultSubdivision;
diff --git a/include/basegfx/polygon/b2dlinegeometry.hxx b/include/basegfx/polygon/b2dlinegeometry.hxx
index 0c9b7b1..cdcd322 100644
--- a/include/basegfx/polygon/b2dlinegeometry.hxx
+++ b/include/basegfx/polygon/b2dlinegeometry.hxx
@@ -139,11 +139,6 @@ namespace basegfx
             double fMaxPartOfEdge = 0.4,
             double fMiterMinimumAngle = (15.0 * F_PI180));
 
-        BASEGFX_DLLPUBLIC B2DPolygon polygonSubdivide(
-            const B2DPolygon& rCandidate,
-            double fMaxAllowedAngle = (12.5 * F_PI180),
-            double fMaxPartOfEdge = 0.4);
-
     } // end of namespace tools
 } // end of namespace basegfx
 
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 424f4be..2beb5fe 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -2045,9 +2045,7 @@ bool OpenGLSalGraphicsImpl::drawPolyLine(
         basegfx::B2DPolygon aPolygon(rPolygon);
 
         if (aPolygon.areControlPointsUsed())
-            aPolygon = basegfx::tools::polygonSubdivide(aPolygon, 7.5 * F_PI180);
-        else
-            aPolygon.removeDoublePoints();
+            aPolygon = aPolygon.getDefaultAdaptiveSubdivision();
 
         DrawPolyLine(aPolygon, fLineWidth, eLineJoin, eLineCap);
     }


More information about the Libreoffice-commits mailing list