diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2019-06-08 21:49:50 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2019-06-10 20:00:58 +0200 |
commit | 39599fc689364b70cf83e834a5742cc2181b13b0 (patch) | |
tree | 5fac8d65185a2a44fd507268226f6b14a30e6b82 /svx/source/customshapes | |
parent | c473c5b462f33df439b4b62b394c5d7811a05c7c (diff) |
tdf#125782 use correct 'current point' for quadraticcurveto
Use the same way to get the 'current point' as in
command arcangleto. The error was visible in shape teardrop.
Change-Id: Ie7af2b9111150bae7e3ea492eeb439a0cc2bfe7c
Reviewed-on: https://gerrit.libreoffice.org/73723
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 256b96cd5362..482650fdf9d0 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -2292,27 +2292,21 @@ void EnhancedCustomShape2d::CreateSubPath( { for ( sal_Int32 i(0); ( i < nPntCount ) && ( rSrcPt + 1 < nCoordSize ); i++ ) { - if ( rSrcPt ) + DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error no previous point for Q (!)"); + if (aNewB2DPolygon.count() > 0) { - const Point aPreviousEndPoint(GetPoint( seqCoordinates[ rSrcPt - 1 ], true, true)); - const Point aControlQ(GetPoint( seqCoordinates[ rSrcPt++ ], true, true )); - const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], true, true )); - const Point aControlA((aPreviousEndPoint + (aControlQ * 2)) / 3); - const Point aControlB(((aControlQ * 2) + aEnd) / 3); - - DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding Q control point (!)"); - aNewB2DPolygon.appendBezierSegment( - basegfx::B2DPoint(aControlA.X(), aControlA.Y()), - basegfx::B2DPoint(aControlB.X(), aControlB.Y()), - basegfx::B2DPoint(aEnd.X(), aEnd.Y())); + const basegfx::B2DPoint aPreviousEndPoint(aNewB2DPolygon.getB2DPoint(aNewB2DPolygon.count()-1)); + const basegfx::B2DPoint aControlQ(GetPointAsB2DPoint( seqCoordinates[ rSrcPt++ ], true, true )); + const basegfx::B2DPoint aEnd(GetPointAsB2DPoint( seqCoordinates[ rSrcPt++ ], true, true )); + const basegfx::B2DPoint aControlA((aPreviousEndPoint + (aControlQ * 2)) / 3); + const basegfx::B2DPoint aControlB(((aControlQ * 2) + aEnd) / 3); + aNewB2DPolygon.appendBezierSegment(aControlA, aControlB, aEnd); } - else // no previous point , do a moveto + else // no previous point; ill structured path, but try to draw as much as possible { rSrcPt++; // skip control point - const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], true, true )); - - DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding Q control point (!)"); - aNewB2DPolygon.append(basegfx::B2DPoint(aEnd.X(), aEnd.Y())); + const basegfx::B2DPoint aEnd(GetPointAsB2DPoint( seqCoordinates[ rSrcPt++ ], true, true )); + aNewB2DPolygon.append(aEnd); } } } |