[Libreoffice-commits] core.git: vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 2 12:13:25 UTC 2020


 vcl/skia/gdiimpl.cxx |   29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

New commits:
commit b07f93c31ba4b652b92d7b8e40edb3ca584f04f6
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Jul 2 10:07:24 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Jul 2 14:12:41 2020 +0200

    do not convert straight lines in polygons to cubic for SkPath
    
    Change-Id: If8a088daa7971509cf12b508f956bed28a6c053b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97724
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 3dd70b822411..addb0903c499 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -89,20 +89,25 @@ void addPolygonToPath(const basegfx::B2DPolygon& rPolygon, SkPath& rPath)
             basegfx::B2DPoint aPreviousControlPoint = rPolygon.getNextControlPoint(nPreviousIndex);
             basegfx::B2DPoint aCurrentControlPoint = rPolygon.getPrevControlPoint(nCurrentIndex);
 
-            if (aPreviousControlPoint.equal(aPreviousPoint))
-            {
-                aPreviousControlPoint
-                    = aPreviousPoint + ((aPreviousControlPoint - aCurrentPoint) * 0.0005);
-            }
-
-            if (aCurrentControlPoint.equal(aCurrentPoint))
+            if (aPreviousControlPoint.equal(aPreviousPoint)
+                && aCurrentControlPoint.equal(aCurrentPoint))
+                rPath.lineTo(aCurrentPoint.getX(), aCurrentPoint.getY()); // a straight line
+            else
             {
-                aCurrentControlPoint
-                    = aCurrentPoint + ((aCurrentControlPoint - aPreviousPoint) * 0.0005);
+                if (aPreviousControlPoint.equal(aPreviousPoint))
+                {
+                    aPreviousControlPoint
+                        = aPreviousPoint + ((aPreviousControlPoint - aCurrentPoint) * 0.0005);
+                }
+                if (aCurrentControlPoint.equal(aCurrentPoint))
+                {
+                    aCurrentControlPoint
+                        = aCurrentPoint + ((aCurrentControlPoint - aPreviousPoint) * 0.0005);
+                }
+                rPath.cubicTo(aPreviousControlPoint.getX(), aPreviousControlPoint.getY(),
+                              aCurrentControlPoint.getX(), aCurrentControlPoint.getY(),
+                              aCurrentPoint.getX(), aCurrentPoint.getY());
             }
-            rPath.cubicTo(aPreviousControlPoint.getX(), aPreviousControlPoint.getY(),
-                          aCurrentControlPoint.getX(), aCurrentControlPoint.getY(),
-                          aCurrentPoint.getX(), aCurrentPoint.getY());
         }
         aPreviousPoint = aCurrentPoint;
         nPreviousIndex = nCurrentIndex;


More information about the Libreoffice-commits mailing list