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 #ifndef SkCurveMeasure_DEFINED | 8 #ifndef SkCurveMeasure_DEFINED |
9 #define SkCurveMeasure_DEFINED | 9 #define SkCurveMeasure_DEFINED |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 Sk8f xCoeff[3]; | 40 Sk8f xCoeff[3]; |
41 Sk8f yCoeff[3]; | 41 Sk8f yCoeff[3]; |
42 }; | 42 }; |
43 | 43 |
44 class SkCurveMeasure { | 44 class SkCurveMeasure { |
45 public: | 45 public: |
46 SkCurveMeasure() {} | 46 SkCurveMeasure() {} |
47 SkCurveMeasure(const SkPoint* pts, SkSegType segType); | 47 SkCurveMeasure(const SkPoint* pts, SkSegType segType); |
48 | 48 |
49 SkScalar getTime(SkScalar targetLength); | 49 SkScalar getTime(SkScalar targetLength); |
50 void getPosTan(SkScalar distance, SkPoint* pos, SkVector* tan); | 50 void getPosTanTime(SkScalar distance, SkPoint* pos, SkVector* tan, SkScalar*
time); |
51 SkScalar getLength(); | 51 SkScalar getLength(); |
52 | 52 |
53 private: | 53 private: |
54 SkPoint evaluateQuad(SkScalar t); | 54 SkPoint evaluateQuad(SkScalar t); |
55 SkVector evaluateQuadDerivative(SkScalar t); | 55 SkVector evaluateQuadDerivative(SkScalar t); |
56 //SkPoint evaluate_cubic(SkScalar t); | 56 //SkPoint evaluate_cubic(SkScalar t); |
57 //SkVector evaluate_cubic_derivative(SkScalar t); | 57 //SkVector evaluate_cubic_derivative(SkScalar t); |
58 //SkPoint evaluate_conic(SkScalar t); | 58 //SkPoint evaluate_conic(SkScalar t); |
59 //SkVector evaluate_conic_derivative(SkScalar t); | 59 //SkVector evaluate_conic_derivative(SkScalar t); |
60 | 60 |
61 const SkScalar kTolerance = 0.0001f; | 61 const SkScalar kTolerance = 0.0001f; |
62 const int kNewtonIters = 5; | 62 const int kNewtonIters = 5; |
63 const int kBisectIters = 5; | 63 const int kBisectIters = 5; |
64 | 64 |
65 SkSegType fSegType; | 65 SkSegType fSegType; |
66 SkPoint fPts[4]; | 66 SkPoint fPts[4]; |
67 SkScalar fLength = -1.0f; | 67 SkScalar fLength = -1.0f; |
68 ArcLengthIntegrator fIntegrator; | 68 ArcLengthIntegrator fIntegrator; |
69 | 69 |
70 // for debug purposes | 70 // for debug purposes |
71 int fIters; | 71 int fIters; |
72 }; | 72 }; |
73 | 73 |
74 #endif // SkCurveMeasure_DEFINED | 74 #endif // SkCurveMeasure_DEFINED |
OLD | NEW |