std::unique_ptr<InterpolableValue> consumeArc(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); std::unique_ptr<InterpolableList> result = InterpolableList::create(7); result->set( 0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); result->set( 1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); result->set(2, InterpolableNumber::create(segment.r1())); result->set(3, InterpolableNumber::create(segment.r2())); result->set(4, InterpolableNumber::create(segment.arcAngle())); result->set(5, InterpolableBool::create(segment.largeArcFlag())); result->set(6, InterpolableBool::create(segment.sweepFlag())); return std::move(result); }
void SVGPathBuilder::emitSegment(const PathSegmentData& segment) { switch (segment.command) { case PathSegClosePath: emitClose(); break; case PathSegMoveToAbs: emitMoveTo( segment.targetPoint); break; case PathSegMoveToRel: emitMoveTo( m_currentPoint + segment.targetPoint); break; case PathSegLineToAbs: emitLineTo( segment.targetPoint); break; case PathSegLineToRel: emitLineTo( m_currentPoint + segment.targetPoint); break; case PathSegLineToHorizontalAbs: emitLineTo( FloatPoint(segment.targetPoint.x(), m_currentPoint.y())); break; case PathSegLineToHorizontalRel: emitLineTo( m_currentPoint + FloatSize(segment.targetPoint.x(), 0)); break; case PathSegLineToVerticalAbs: emitLineTo( FloatPoint(m_currentPoint.x(), segment.targetPoint.y())); break; case PathSegLineToVerticalRel: emitLineTo( m_currentPoint + FloatSize(0, segment.targetPoint.y())); break; case PathSegCurveToQuadraticAbs: emitQuadTo( segment.point1, segment.targetPoint); break; case PathSegCurveToQuadraticRel: emitQuadTo( m_currentPoint + segment.point1, m_currentPoint + segment.targetPoint); break; case PathSegCurveToQuadraticSmoothAbs: emitSmoothQuadTo( segment.targetPoint); break; case PathSegCurveToQuadraticSmoothRel: emitSmoothQuadTo( m_currentPoint + segment.targetPoint); break; case PathSegCurveToCubicAbs: emitCubicTo( segment.point1, segment.point2, segment.targetPoint); break; case PathSegCurveToCubicRel: emitCubicTo( m_currentPoint + segment.point1, m_currentPoint + segment.point2, m_currentPoint + segment.targetPoint); break; case PathSegCurveToCubicSmoothAbs: emitSmoothCubicTo( segment.point2, segment.targetPoint); break; case PathSegCurveToCubicSmoothRel: emitSmoothCubicTo( m_currentPoint + segment.point2, m_currentPoint + segment.targetPoint); break; case PathSegArcAbs: emitArcTo( segment.targetPoint, toFloatSize(segment.arcRadii()), segment.arcAngle(), segment.largeArcFlag(), segment.sweepFlag()); break; case PathSegArcRel: emitArcTo( m_currentPoint + segment.targetPoint, toFloatSize(segment.arcRadii()), segment.arcAngle(), segment.largeArcFlag(), segment.sweepFlag()); break; default: ASSERT_NOT_REACHED(); } m_lastCommand = segment.command; }