bool buildSVGPathByteStreamFromString(const String& d, SVGPathByteStream& result, PathParsingMode parsingMode) { result.clear(); if (d.isEmpty()) return true; // The string length is typically a minor overestimate of eventual byte stream size, so it avoids us a lot of reallocs. result.reserveInitialCapacity(d.length()); SVGPathByteStreamBuilder builder(result); SVGPathStringSource source(d); SVGPathParser parser(&source, &builder); bool ok = parser.parsePathDataFromSource(parsingMode); result.shrinkToFit(); return ok; }