OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 SVGPathParser::parsePath(source, builder); | 55 SVGPathParser::parsePath(source, builder); |
56 return builder.result(); | 56 return builder.result(); |
57 } | 57 } |
58 | 58 |
59 SVGParsingError buildByteStreamFromString(const String& d, | 59 SVGParsingError buildByteStreamFromString(const String& d, |
60 SVGPathByteStream& result) { | 60 SVGPathByteStream& result) { |
61 result.clear(); | 61 result.clear(); |
62 if (d.isEmpty()) | 62 if (d.isEmpty()) |
63 return SVGParseStatus::NoError; | 63 return SVGParseStatus::NoError; |
64 | 64 |
65 // The string length is typically a minor overestimate of eventual byte stream
size, so it avoids us a lot of reallocs. | 65 // The string length is typically a minor overestimate of eventual byte stream |
| 66 // size, so it avoids us a lot of reallocs. |
66 result.reserveInitialCapacity(d.length()); | 67 result.reserveInitialCapacity(d.length()); |
67 | 68 |
68 SVGPathByteStreamBuilder builder(result); | 69 SVGPathByteStreamBuilder builder(result); |
69 SVGPathStringSource source(d); | 70 SVGPathStringSource source(d); |
70 SVGPathParser::parsePath(source, builder); | 71 SVGPathParser::parsePath(source, builder); |
71 result.shrinkToFit(); | 72 result.shrinkToFit(); |
72 return source.parseError(); | 73 return source.parseError(); |
73 } | 74 } |
74 | 75 |
75 } // namespace blink | 76 } // namespace blink |
OLD | NEW |