SVGPathTraversalStateBuilder.cpp [plain text]
#include "config.h"
#include "SVGPathTraversalStateBuilder.h"
#include "PathTraversalState.h"
namespace WebCore {
SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder(PathTraversalState& state, float desiredLength)
: m_traversalState(state)
{
m_traversalState.setDesiredLength(desiredLength);
}
void SVGPathTraversalStateBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode)
{
m_traversalState.processPathElement(PathElementMoveToPoint, &targetPoint);
}
void SVGPathTraversalStateBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode)
{
m_traversalState.processPathElement(PathElementAddLineToPoint, &targetPoint);
}
void SVGPathTraversalStateBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode)
{
FloatPoint points[] = { point1, point2, targetPoint };
m_traversalState.processPathElement(PathElementAddCurveToPoint, points);
}
void SVGPathTraversalStateBuilder::closePath()
{
m_traversalState.processPathElement(PathElementCloseSubpath, nullptr);
}
bool SVGPathTraversalStateBuilder::continueConsuming()
{
return !m_traversalState.success();
}
float SVGPathTraversalStateBuilder::totalLength() const
{
return m_traversalState.totalLength();
}
SVGPoint SVGPathTraversalStateBuilder::currentPoint() const
{
return m_traversalState.current();
}
}