diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-06-25 10:45:48 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-06-28 03:15:08 +0200 |
commit | 80eb3fd393dd6d67f931c03b261b2558c7198da2 (patch) | |
tree | 49d4437af42942f3dee68c39b858e5d8762bf0cc /basegfx/source/polygon/b2dsvgpolypolygon.cxx | |
parent | Give a parent to the Position and Size (Transform) dialog (diff) | |
download | core-80eb3fd393dd6d67f931c03b261b2558c7198da2.tar.gz core-80eb3fd393dd6d67f931c03b261b2558c7198da2.zip |
add appendQuadraticBezierSegment to B2DPolygon
This adds a convenience method to B2DPolygon to add a quadratic
bezier segment, which converts its one control point to two
control points of a cubic bezier segment.
The SVG path import is also modified to use this new method
instead of converting inside the importer itself.
Change-Id: I96e9b306066d9ccf2542b17a117db01fa235f405
Reviewed-on: https://gerrit.libreoffice.org/74809
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'basegfx/source/polygon/b2dsvgpolypolygon.cxx')
-rw-r--r-- | basegfx/source/polygon/b2dsvgpolypolygon.cxx | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 43ad5ee95596..991e50bf60f0 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -375,12 +375,6 @@ namespace basegfx nY += nLastY; } - // calculate the cubic bezier coefficients from the quadratic ones - const double nX1Prime((nX1 * 2.0 + nLastX) / 3.0); - const double nY1Prime((nY1 * 2.0 + nLastY) / 3.0); - const double nX2Prime((nX1 * 2.0 + nX) / 3.0); - const double nY2Prime((nY1 * 2.0 + nY) / 3.0); - // ensure existence of start point if(!aCurrPoly.count()) { @@ -388,7 +382,7 @@ namespace basegfx } // append curved edge - aCurrPoly.appendBezierSegment(B2DPoint(nX1Prime, nY1Prime), B2DPoint(nX2Prime, nY2Prime), B2DPoint(nX, nY)); + aCurrPoly.appendQuadraticBezierSegment(B2DPoint(nX1, nY1), B2DPoint(nX, nY)); // set last position nLastX = nX; |