diff options
author | Armin Le Grand <alg@apache.org> | 2012-12-10 14:45:55 +0000 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2013-06-03 13:44:51 +0200 |
commit | 76bbe5ff357406ac1e0f212373c9fd4132b0d178 (patch) | |
tree | 75382cd4d76f96795fd1c59ee854a2fc04addb3d /svx | |
parent | be4bf1016e66e74bc2ab8d031cae2ffb2a0777d8 (diff) |
#121437# Added patch from Regina which implements QuadraticBezier segemnts to CustomShapes
Patch by: Regina
Review by: ALG
(cherry picked from commit 4faa46872cad4ed779b07803b7f616b32d800284)
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 0675abde78c8..e5d5c2bae481 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1562,6 +1562,36 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm } break; + case QUADRATICCURVETO :
+ {
+ for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 1 ) < nCoordSize ); i++ )
+ {
+ if ( rSrcPt )
+ {
+ const Point aPreviousEndPoint(GetPoint( seqCoordinates[ rSrcPt - 1 ], sal_True, sal_True));
+ const Point aControlQ(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+ const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_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()));
+ }
+ else // no previous point , do a moveto
+ {
+ rSrcPt++; // skip control point
+ const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+
+ DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding Q control point (!)");
+ aNewB2DPolygon.append(basegfx::B2DPoint(aEnd.X(), aEnd.Y()));
+ }
+ }
+ }
+ break;
+
case ANGLEELLIPSE : { if ( nPntCount ) |