This source file includes following definitions.
- moveTo
- lineTo
- curveToCubic
- closePath
- setDesiredLength
- continueConsuming
- incrementPathSegmentCount
- pathSegmentIndex
- totalLength
- currentPoint
#include "config.h"
#include "platform/graphics/PathTraversalState.h"
#include "core/svg/SVGPathTraversalStateBuilder.h"
namespace WebCore {
SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder()
: m_traversalState(0)
{
}
void SVGPathTraversalStateBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode)
{
ASSERT(m_traversalState);
m_traversalState->m_totalLength += m_traversalState->moveTo(targetPoint);
}
void SVGPathTraversalStateBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode)
{
ASSERT(m_traversalState);
m_traversalState->m_totalLength += m_traversalState->lineTo(targetPoint);
}
void SVGPathTraversalStateBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode)
{
ASSERT(m_traversalState);
m_traversalState->m_totalLength += m_traversalState->cubicBezierTo(point1, point2, targetPoint);
}
void SVGPathTraversalStateBuilder::closePath()
{
ASSERT(m_traversalState);
m_traversalState->m_totalLength += m_traversalState->closeSubpath();
}
void SVGPathTraversalStateBuilder::setDesiredLength(float desiredLength)
{
ASSERT(m_traversalState);
m_traversalState->m_desiredLength = desiredLength;
}
bool SVGPathTraversalStateBuilder::continueConsuming()
{
ASSERT(m_traversalState);
m_traversalState->processSegment();
return !m_traversalState->m_success;
}
void SVGPathTraversalStateBuilder::incrementPathSegmentCount()
{
ASSERT(m_traversalState);
++m_traversalState->m_segmentIndex;
}
unsigned SVGPathTraversalStateBuilder::pathSegmentIndex()
{
ASSERT(m_traversalState);
return m_traversalState->m_segmentIndex;
}
float SVGPathTraversalStateBuilder::totalLength()
{
ASSERT(m_traversalState);
return m_traversalState->m_totalLength;
}
FloatPoint SVGPathTraversalStateBuilder::currentPoint()
{
ASSERT(m_traversalState);
return m_traversalState->m_current;
}
}