bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream* stream, float length, SVGPoint& point) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::Action::VectorAtLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); auto source = std::make_unique<SVGPathByteStreamSource>(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); point = builder->currentPoint(); parser->cleanup(); return ok; }
bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream* stream, float length, FloatPoint& point) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); point = builder->currentPoint(); parser->cleanup(); return ok; }