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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 SVGPathByteStreamSource bySource(byStream); | 100 SVGPathByteStreamSource bySource(byStream); |
101 SVGPathBlender blender(&fromSource, &bySource, &builder); | 101 SVGPathBlender blender(&fromSource, &bySource, &builder); |
102 return blender.addAnimatedPath(repeatCount); | 102 return blender.addAnimatedPath(repeatCount); |
103 } | 103 } |
104 | 104 |
105 unsigned getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& str
eam, float length) | 105 unsigned getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& str
eam, float length) |
106 { | 106 { |
107 if (stream.isEmpty()) | 107 if (stream.isEmpty()) |
108 return 0; | 108 return 0; |
109 | 109 |
110 PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLeng
th); | 110 SVGPathTraversalStateBuilder builder(PathTraversalState::TraversalSegmentAtL
ength, length); |
111 SVGPathTraversalStateBuilder builder(traversalState, length); | |
112 SVGPathByteStreamSource source(stream); | 111 SVGPathByteStreamSource source(stream); |
113 SVGPathParser parser(&source, &builder); | 112 SVGPathParser parser(&source, &builder); |
114 parser.parsePathDataFromSource(NormalizedParsing); | 113 parser.parsePathDataFromSource(NormalizedParsing); |
115 return builder.pathSegmentIndex(); | 114 return builder.pathSegmentIndex(); |
116 } | 115 } |
117 | 116 |
118 float getTotalLengthOfSVGPathByteStream(const SVGPathByteStream& stream) | 117 float getTotalLengthOfSVGPathByteStream(const SVGPathByteStream& stream) |
119 { | 118 { |
120 if (stream.isEmpty()) | 119 if (stream.isEmpty()) |
121 return 0; | 120 return 0; |
122 | 121 |
123 PathTraversalState traversalState(PathTraversalState::TraversalTotalLength); | 122 SVGPathTraversalStateBuilder builder(PathTraversalState::TraversalTotalLengt
h); |
124 SVGPathTraversalStateBuilder builder(traversalState); | |
125 SVGPathByteStreamSource source(stream); | 123 SVGPathByteStreamSource source(stream); |
126 SVGPathParser parser(&source, &builder); | 124 SVGPathParser parser(&source, &builder); |
127 parser.parsePathDataFromSource(NormalizedParsing); | 125 parser.parsePathDataFromSource(NormalizedParsing); |
128 return builder.totalLength(); | 126 return builder.totalLength(); |
129 } | 127 } |
130 | 128 |
131 FloatPoint getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream,
float length) | 129 FloatPoint getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream,
float length) |
132 { | 130 { |
133 if (stream.isEmpty()) | 131 if (stream.isEmpty()) |
134 return FloatPoint(); | 132 return FloatPoint(); |
135 | 133 |
136 PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength
); | 134 SVGPathTraversalStateBuilder builder(PathTraversalState::TraversalPointAtLen
gth, length); |
137 SVGPathTraversalStateBuilder builder(traversalState, length); | |
138 SVGPathByteStreamSource source(stream); | 135 SVGPathByteStreamSource source(stream); |
139 SVGPathParser parser(&source, &builder); | 136 SVGPathParser parser(&source, &builder); |
140 parser.parsePathDataFromSource(NormalizedParsing); | 137 parser.parsePathDataFromSource(NormalizedParsing); |
141 return builder.currentPoint(); | 138 return builder.currentPoint(); |
142 } | 139 } |
143 | 140 |
144 } | 141 } |
OLD | NEW |