Author: alg Date: Mon Dec 10 15:45:55 2012 New Revision: 1419533 URL: http://svn.apache.org/viewvc?rev=1419533&view=rev Log: #121437# Added patch from Regina which implements QuadraticBezier segemnts to CustomShapes Patch by: Regina Review by: ALG
Modified: openoffice/trunk/main/svx/source/customshapes/EnhancedCustomShape2d.cxx Modified: openoffice/trunk/main/svx/source/customshapes/EnhancedCustomShape2d.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/customshapes/EnhancedCustomShape2d.cxx?rev=1419533&r1=1419532&r2=1419533&view=diff ============================================================================== --- openoffice/trunk/main/svx/source/customshapes/EnhancedCustomShape2d.cxx (original) +++ openoffice/trunk/main/svx/source/customshapes/EnhancedCustomShape2d.cxx Mon Dec 10 15:45:55 2012 @@ -1495,6 +1495,36 @@ void EnhancedCustomShape2d::CreateSubPat } 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 )