Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPathUtilities.cpp

Issue 1460253002: SVGPath object "mutability" cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Template fail. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698