| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 OwnPtr<SVGPathByteStream> fromStreamCopy = fromStream.copy(); | 96 OwnPtr<SVGPathByteStream> fromStreamCopy = fromStream.copy(); |
| 97 fromStream.clear(); | 97 fromStream.clear(); |
| 98 | 98 |
| 99 SVGPathByteStreamBuilder builder(fromStream); | 99 SVGPathByteStreamBuilder builder(fromStream); |
| 100 SVGPathByteStreamSource fromSource(*fromStreamCopy); | 100 SVGPathByteStreamSource fromSource(*fromStreamCopy); |
| 101 SVGPathByteStreamSource bySource(byStream); | 101 SVGPathByteStreamSource bySource(byStream); |
| 102 SVGPathBlender blender(&fromSource, &bySource, &builder); | 102 SVGPathBlender blender(&fromSource, &bySource, &builder); |
| 103 return blender.addAnimatedPath(repeatCount); | 103 return blender.addAnimatedPath(repeatCount); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& stream,
float length, unsigned& pathSeg) | 106 unsigned getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& str
eam, float length) |
| 107 { | 107 { |
| 108 if (stream.isEmpty()) | 108 if (stream.isEmpty()) |
| 109 return false; | 109 return 0; |
| 110 | 110 |
| 111 PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLeng
th); | 111 PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLeng
th); |
| 112 SVGPathTraversalStateBuilder builder(traversalState, length); | 112 SVGPathTraversalStateBuilder builder(traversalState, length); |
| 113 SVGPathByteStreamSource source(stream); | 113 SVGPathByteStreamSource source(stream); |
| 114 SVGPathParser parser(&source, &builder); | 114 SVGPathParser parser(&source, &builder); |
| 115 bool ok = parser.parsePathDataFromSource(NormalizedParsing); | 115 parser.parsePathDataFromSource(NormalizedParsing); |
| 116 pathSeg = builder.pathSegmentIndex(); | 116 return builder.pathSegmentIndex(); |
| 117 return ok; | |
| 118 } | 117 } |
| 119 | 118 |
| 120 bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float& t
otalLength) | 119 float getTotalLengthOfSVGPathByteStream(const SVGPathByteStream& stream) |
| 121 { | 120 { |
| 122 if (stream.isEmpty()) | 121 if (stream.isEmpty()) |
| 123 return false; | 122 return 0; |
| 124 | 123 |
| 125 PathTraversalState traversalState(PathTraversalState::TraversalTotalLength); | 124 PathTraversalState traversalState(PathTraversalState::TraversalTotalLength); |
| 126 SVGPathTraversalStateBuilder builder(traversalState); | 125 SVGPathTraversalStateBuilder builder(traversalState); |
| 127 SVGPathByteStreamSource source(stream); | 126 SVGPathByteStreamSource source(stream); |
| 128 SVGPathParser parser(&source, &builder); | 127 SVGPathParser parser(&source, &builder); |
| 129 bool ok = parser.parsePathDataFromSource(NormalizedParsing); | 128 parser.parsePathDataFromSource(NormalizedParsing); |
| 130 totalLength = builder.totalLength(); | 129 return builder.totalLength(); |
| 131 return ok; | |
| 132 } | 130 } |
| 133 | 131 |
| 134 bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float
length, FloatPoint& point) | 132 FloatPoint getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream,
float length) |
| 135 { | 133 { |
| 136 if (stream.isEmpty()) | 134 if (stream.isEmpty()) |
| 137 return false; | 135 return FloatPoint(); |
| 138 | 136 |
| 139 PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength
); | 137 PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength
); |
| 140 SVGPathTraversalStateBuilder builder(traversalState, length); | 138 SVGPathTraversalStateBuilder builder(traversalState, length); |
| 141 SVGPathByteStreamSource source(stream); | 139 SVGPathByteStreamSource source(stream); |
| 142 SVGPathParser parser(&source, &builder); | 140 SVGPathParser parser(&source, &builder); |
| 143 bool ok = parser.parsePathDataFromSource(NormalizedParsing); | 141 parser.parsePathDataFromSource(NormalizedParsing); |
| 144 point = builder.currentPoint(); | 142 return builder.currentPoint(); |
| 145 return ok; | |
| 146 } | 143 } |
| 147 | 144 |
| 148 } | 145 } |
| OLD | NEW |