bool SVGPathParserFactory::buildAnimatedSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* toStream, OwnPtr<SVGPathByteStream>& result, float progress) { ASSERT(fromStream); ASSERT(toStream); result = SVGPathByteStream::create(); if (fromStream->isEmpty() || toStream->isEmpty()) return false; SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(result.get()); OwnPtr<SVGPathByteStreamSource> fromSource = SVGPathByteStreamSource::create(fromStream); OwnPtr<SVGPathByteStreamSource> toSource = SVGPathByteStreamSource::create(toStream); SVGPathBlender* blender = globalSVGPathBlender(); bool ok = blender->blendAnimatedPath(progress, fromSource.get(), toSource.get(), builder); blender->cleanup(); return ok; }
bool addToSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* byStream, unsigned repeatCount) { ASSERT(fromStream); ASSERT(byStream); if (fromStream->isEmpty() || byStream->isEmpty()) return true; SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(fromStream); auto fromStreamCopy = fromStream->copy(); fromStream->clear(); auto fromSource = std::make_unique<SVGPathByteStreamSource>(fromStreamCopy.get()); auto bySource = std::make_unique<SVGPathByteStreamSource>(byStream); SVGPathBlender* blender = globalSVGPathBlender(); bool ok = blender->addAnimatedPath(fromSource.get(), bySource.get(), builder, repeatCount); blender->cleanup(); return ok; }
bool addToSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* byStream, unsigned repeatCount) { ASSERT(fromStream); ASSERT(byStream); if (fromStream->isEmpty() || byStream->isEmpty()) return false; SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(fromStream); OwnPtr<SVGPathByteStream> fromStreamCopy = fromStream->copy(); fromStream->clear(); OwnPtr<SVGPathByteStreamSource> fromSource = SVGPathByteStreamSource::create(fromStreamCopy.get()); OwnPtr<SVGPathByteStreamSource> bySource = SVGPathByteStreamSource::create(byStream); SVGPathBlender* blender = globalSVGPathBlender(); bool ok = blender->addAnimatedPath(fromSource.get(), bySource.get(), builder, repeatCount); blender->cleanup(); return ok; }
bool buildAnimatedSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* toStream, SVGPathByteStream* result, float progress) { ASSERT(fromStream); ASSERT(toStream); ASSERT(result); ASSERT(toStream != result); result->clear(); if (toStream->isEmpty()) return true; SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(result); auto fromSource = std::make_unique<SVGPathByteStreamSource>(fromStream); auto toSource = std::make_unique<SVGPathByteStreamSource>(toStream); SVGPathBlender* blender = globalSVGPathBlender(); bool ok = blender->blendAnimatedPath(progress, fromSource.get(), toSource.get(), builder); blender->cleanup(); return ok; }