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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 { | 44 { |
45 if (stream.isEmpty()) | 45 if (stream.isEmpty()) |
46 return true; | 46 return true; |
47 | 47 |
48 SVGPathBuilder builder(result); | 48 SVGPathBuilder builder(result); |
49 SVGPathByteStreamSource source(stream); | 49 SVGPathByteStreamSource source(stream); |
50 SVGPathParser parser(&source, &builder); | 50 SVGPathParser parser(&source, &builder); |
51 return parser.parsePathDataFromSource(NormalizedParsing); | 51 return parser.parsePathDataFromSource(NormalizedParsing); |
52 } | 52 } |
53 | 53 |
54 String buildStringFromByteStream(const SVGPathByteStream& stream, PathParsingMod
e parsingMode) | 54 String buildStringFromByteStream(const SVGPathByteStream& stream) |
55 { | 55 { |
56 if (stream.isEmpty()) | 56 if (stream.isEmpty()) |
57 return String(); | 57 return String(); |
58 | 58 |
59 SVGPathStringBuilder builder; | 59 SVGPathStringBuilder builder; |
60 SVGPathByteStreamSource source(stream); | 60 SVGPathByteStreamSource source(stream); |
61 SVGPathParser parser(&source, &builder); | 61 SVGPathParser parser(&source, &builder); |
62 parser.parsePathDataFromSource(parsingMode); | 62 parser.parsePathDataFromSource(UnalteredParsing); |
63 return builder.result(); | 63 return builder.result(); |
64 } | 64 } |
65 | 65 |
66 bool buildByteStreamFromString(const String& d, SVGPathByteStream& result) | 66 bool buildByteStreamFromString(const String& d, SVGPathByteStream& result) |
67 { | 67 { |
68 result.clear(); | 68 result.clear(); |
69 if (d.isEmpty()) | 69 if (d.isEmpty()) |
70 return true; | 70 return true; |
71 | 71 |
72 // The string length is typically a minor overestimate of eventual byte stre
am size, so it avoids us a lot of reallocs. | 72 // The string length is typically a minor overestimate of eventual byte stre
am size, so it avoids us a lot of reallocs. |
73 result.reserveInitialCapacity(d.length()); | 73 result.reserveInitialCapacity(d.length()); |
74 | 74 |
75 SVGPathByteStreamBuilder builder(result); | 75 SVGPathByteStreamBuilder builder(result); |
76 SVGPathStringSource source(d); | 76 SVGPathStringSource source(d); |
77 SVGPathParser parser(&source, &builder); | 77 SVGPathParser parser(&source, &builder); |
78 bool ok = parser.parsePathDataFromSource(UnalteredParsing); | 78 bool ok = parser.parsePathDataFromSource(UnalteredParsing); |
79 result.shrinkToFit(); | 79 result.shrinkToFit(); |
80 return ok; | 80 return ok; |
81 } | 81 } |
82 | 82 |
83 } | 83 } |
OLD | NEW |