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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 result.reserveInitialCapacity(d.length()); | 78 result.reserveInitialCapacity(d.length()); |
79 | 79 |
80 SVGPathByteStreamBuilder builder(result); | 80 SVGPathByteStreamBuilder builder(result); |
81 SVGPathStringSource source(d); | 81 SVGPathStringSource source(d); |
82 SVGPathParser parser(&source, &builder); | 82 SVGPathParser parser(&source, &builder); |
83 bool ok = parser.parsePathDataFromSource(parsingMode); | 83 bool ok = parser.parsePathDataFromSource(parsingMode); |
84 result.shrinkToFit(); | 84 result.shrinkToFit(); |
85 return ok; | 85 return ok; |
86 } | 86 } |
87 | 87 |
88 bool addToSVGPathByteStream(SVGPathByteStream& fromStream, const SVGPathByteStre
am& byStream, unsigned repeatCount) | |
89 { | |
90 if (fromStream.isEmpty() || byStream.isEmpty()) | |
91 return true; | |
92 | |
93 OwnPtr<SVGPathByteStream> fromStreamCopy = fromStream.copy(); | |
94 fromStream.clear(); | |
95 | |
96 SVGPathByteStreamBuilder builder(fromStream); | |
97 SVGPathByteStreamSource fromSource(*fromStreamCopy); | |
98 SVGPathByteStreamSource bySource(byStream); | |
99 SVGPathBlender blender(&fromSource, &bySource, &builder); | |
100 return blender.addAnimatedPath(repeatCount); | |
101 } | |
102 | |
103 unsigned getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& str
eam, float length) | 88 unsigned getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& str
eam, float length) |
104 { | 89 { |
105 if (stream.isEmpty()) | 90 if (stream.isEmpty()) |
106 return 0; | 91 return 0; |
107 | 92 |
108 SVGPathTraversalStateBuilder builder(PathTraversalState::TraversalSegmentAtL
ength, length); | 93 SVGPathTraversalStateBuilder builder(PathTraversalState::TraversalSegmentAtL
ength, length); |
109 SVGPathByteStreamSource source(stream); | 94 SVGPathByteStreamSource source(stream); |
110 SVGPathParser parser(&source, &builder); | 95 SVGPathParser parser(&source, &builder); |
111 parser.parsePathDataFromSource(NormalizedParsing); | 96 parser.parsePathDataFromSource(NormalizedParsing); |
112 return builder.pathSegmentIndex(); | 97 return builder.pathSegmentIndex(); |
(...skipping 17 matching lines...) Expand all Loading... |
130 return FloatPoint(); | 115 return FloatPoint(); |
131 | 116 |
132 SVGPathTraversalStateBuilder builder(PathTraversalState::TraversalPointAtLen
gth, length); | 117 SVGPathTraversalStateBuilder builder(PathTraversalState::TraversalPointAtLen
gth, length); |
133 SVGPathByteStreamSource source(stream); | 118 SVGPathByteStreamSource source(stream); |
134 SVGPathParser parser(&source, &builder); | 119 SVGPathParser parser(&source, &builder); |
135 parser.parsePathDataFromSource(NormalizedParsing); | 120 parser.parsePathDataFromSource(NormalizedParsing); |
136 return builder.currentPoint(); | 121 return builder.currentPoint(); |
137 } | 122 } |
138 | 123 |
139 } | 124 } |
OLD | NEW |