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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/PathTraversalState.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 years, 11 months 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) 2006, 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006, 2007 Eric Seidel <eric@webkit.org>
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 template <class CurveType> 122 template <class CurveType>
123 static float curveLength(PathTraversalState& traversalState, CurveType curve) { 123 static float curveLength(PathTraversalState& traversalState, CurveType curve) {
124 static const unsigned short curveSplitDepthLimit = 20; 124 static const unsigned short curveSplitDepthLimit = 20;
125 static const double pathSegmentLengthToleranceSquared = 1.e-16; 125 static const double pathSegmentLengthToleranceSquared = 1.e-16;
126 126
127 double curveScaleForToleranceSquared = curve.magnitudeSquared(); 127 double curveScaleForToleranceSquared = curve.magnitudeSquared();
128 if (curveScaleForToleranceSquared < pathSegmentLengthToleranceSquared) 128 if (curveScaleForToleranceSquared < pathSegmentLengthToleranceSquared)
129 return 0; 129 return 0;
130 130
131 Vector<CurveType> curveStack; 131 Vector<CurveType> curveStack;
132 curveStack.append(curve); 132 curveStack.push_back(curve);
133 133
134 float totalLength = 0; 134 float totalLength = 0;
135 do { 135 do {
136 float length = curve.approximateDistance(); 136 float length = curve.approximateDistance();
137 double lengthDiscrepancy = length - distanceLine(curve.start, curve.end); 137 double lengthDiscrepancy = length - distanceLine(curve.start, curve.end);
138 if ((lengthDiscrepancy * lengthDiscrepancy) / 138 if ((lengthDiscrepancy * lengthDiscrepancy) /
139 curveScaleForToleranceSquared > 139 curveScaleForToleranceSquared >
140 pathSegmentLengthToleranceSquared && 140 pathSegmentLengthToleranceSquared &&
141 curve.splitDepth < curveSplitDepthLimit) { 141 curve.splitDepth < curveSplitDepthLimit) {
142 CurveType leftCurve; 142 CurveType leftCurve;
143 CurveType rightCurve; 143 CurveType rightCurve;
144 curve.split(leftCurve, rightCurve); 144 curve.split(leftCurve, rightCurve);
145 curve = leftCurve; 145 curve = leftCurve;
146 curveStack.append(rightCurve); 146 curveStack.push_back(rightCurve);
147 } else { 147 } else {
148 totalLength += length; 148 totalLength += length;
149 if (traversalState.m_action == 149 if (traversalState.m_action ==
150 PathTraversalState::TraversalPointAtLength || 150 PathTraversalState::TraversalPointAtLength ||
151 traversalState.m_action == 151 traversalState.m_action ==
152 PathTraversalState::TraversalNormalAngleAtLength) { 152 PathTraversalState::TraversalNormalAngleAtLength) {
153 traversalState.m_previous = curve.start; 153 traversalState.m_previous = curve.start;
154 traversalState.m_current = curve.end; 154 traversalState.m_current = curve.end;
155 if (traversalState.m_totalLength + totalLength > 155 if (traversalState.m_totalLength + totalLength >
156 traversalState.m_desiredLength) 156 traversalState.m_desiredLength)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 m_current.move(offset * cosf(slope), offset * sinf(slope)); 214 m_current.move(offset * cosf(slope), offset * sinf(slope));
215 } else { 215 } else {
216 m_normalAngle = rad2deg(slope); 216 m_normalAngle = rad2deg(slope);
217 } 217 }
218 m_success = true; 218 m_success = true;
219 } 219 }
220 m_previous = m_current; 220 m_previous = m_current;
221 } 221 }
222 222
223 } // namespace blink 223 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698