OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCurveMeasure.h" | 8 #include "SkCurveMeasure.h" |
9 | 9 |
10 // for abs | 10 // for abs |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 iterations++; | 228 iterations++; |
229 } | 229 } |
230 | 230 |
231 // debug. is there an SKDEBUG or something for ifdefs? | 231 // debug. is there an SKDEBUG or something for ifdefs? |
232 fIters = iterations; | 232 fIters = iterations; |
233 | 233 |
234 return currentT; | 234 return currentT; |
235 } | 235 } |
236 | 236 |
237 void SkCurveMeasure::getPosTan(SkScalar targetLength, SkPoint* pos, | 237 void SkCurveMeasure::getPosTanTime(SkScalar targetLength, SkPoint* pos, |
238 SkVector* tan) { | 238 SkVector* tan, SkScalar* time) { |
239 SkScalar t = getTime(targetLength); | 239 SkScalar t = getTime(targetLength); |
240 | 240 |
| 241 if (time) { |
| 242 *time = t; |
| 243 } |
241 if (pos) { | 244 if (pos) { |
242 // TODO(hstern) switch here on curve type. | 245 // TODO(hstern) switch here on curve type. |
243 *pos = evaluateQuad(t); | 246 *pos = evaluateQuad(t); |
244 } | 247 } |
245 if (tan) { | 248 if (tan) { |
246 // TODO(hstern) switch here on curve type. | 249 // TODO(hstern) switch here on curve type. |
247 *tan = evaluateQuadDerivative(t); | 250 *tan = evaluateQuadDerivative(t); |
248 } | 251 } |
249 } | 252 } |
250 | 253 |
(...skipping 23 matching lines...) Expand all Loading... |
274 SkScalar By = fPts[1].y(); | 277 SkScalar By = fPts[1].y(); |
275 SkScalar Cy = fPts[2].y(); | 278 SkScalar Cy = fPts[2].y(); |
276 | 279 |
277 SkScalar A2BCx = 2.0f*(Ax - 2*Bx + Cx); | 280 SkScalar A2BCx = 2.0f*(Ax - 2*Bx + Cx); |
278 SkScalar A2BCy = 2.0f*(Ay - 2*By + Cy); | 281 SkScalar A2BCy = 2.0f*(Ay - 2*By + Cy); |
279 SkScalar ABx = 2.0f*(Bx - Ax); | 282 SkScalar ABx = 2.0f*(Bx - Ax); |
280 SkScalar ABy = 2.0f*(By - Ay); | 283 SkScalar ABy = 2.0f*(By - Ay); |
281 | 284 |
282 return SkPoint::Make(A2BCx*t + ABx, A2BCy*t + ABy); | 285 return SkPoint::Make(A2BCx*t + ABx, A2BCy*t + ABy); |
283 } | 286 } |
OLD | NEW |