bool addToSVGPathByteStream(SVGPathByteStream& fromStream, const SVGPathByteStream& byStream, unsigned repeatCount) { if (fromStream.isEmpty() || byStream.isEmpty()) return true; OwnPtr<SVGPathByteStream> fromStreamCopy = fromStream.copy(); fromStream.clear(); SVGPathByteStreamBuilder builder(fromStream); SVGPathByteStreamSource fromSource(*fromStreamCopy); SVGPathByteStreamSource bySource(byStream); SVGPathBlender blender(&fromSource, &bySource, &builder); return blender.addAnimatedPath(repeatCount); }
bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount) { // Why return when streamToAppendTo is empty? Don't we still need to append? if (streamToAppendTo.isEmpty() || byStream.isEmpty()) return true; // Is it OK to make the SVGPathByteStreamBuilder from a stream, and then clear that stream? SVGPathByteStreamBuilder builder(streamToAppendTo); SVGPathByteStream fromStreamCopy = streamToAppendTo; streamToAppendTo.clear(); SVGPathByteStreamSource fromSource(fromStreamCopy); SVGPathByteStreamSource bySource(byStream); return SVGPathBlender::addAnimatedPath(fromSource, bySource, builder, repeatCount); }
bool addToSVGPathByteStream(SVGPathByteStream* fromStream, const SVGPathByteStream* byStream, unsigned repeatCount) { ASSERT(fromStream); ASSERT(byStream); if (fromStream->isEmpty() || byStream->isEmpty()) return true; SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(fromStream); OwnPtr<SVGPathByteStream> fromStreamCopy = fromStream->copy(); fromStream->clear(); SVGPathByteStreamSource fromSource(fromStreamCopy.get()); SVGPathByteStreamSource bySource(byStream); SVGPathBlender* blender = globalSVGPathBlender(); bool ok = blender->addAnimatedPath(&fromSource, &bySource, builder, repeatCount); blender->cleanup(); return ok; }