OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkGeometry_DEFINED | 8 #ifndef SkGeometry_DEFINED |
9 #define SkGeometry_DEFINED | 9 #define SkGeometry_DEFINED |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5]); | 97 int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5]); |
98 | 98 |
99 /** Given 3 points on a quadratic bezier, use degree elevation to | 99 /** Given 3 points on a quadratic bezier, use degree elevation to |
100 convert it into the cubic fitting the same curve. The new cubic | 100 convert it into the cubic fitting the same curve. The new cubic |
101 curve is returned in dst[0..3]. | 101 curve is returned in dst[0..3]. |
102 */ | 102 */ |
103 SK_API void SkConvertQuadToCubic(const SkPoint src[3], SkPoint dst[4]); | 103 SK_API void SkConvertQuadToCubic(const SkPoint src[3], SkPoint dst[4]); |
104 | 104 |
105 /////////////////////////////////////////////////////////////////////////////// | 105 /////////////////////////////////////////////////////////////////////////////// |
106 | 106 |
107 /** Convert from parametric from (pts) to polynomial coefficients | |
108 coeff[0]*T^3 + coeff[1]*T^2 + coeff[2]*T + coeff[3] | |
109 */ | |
110 void SkGetCubicCoeff(const SkPoint pts[4], SkScalar cx[4], SkScalar cy[4]); | |
111 | |
112 /** Set pt to the point on the src cubic specified by t. t must be | 107 /** Set pt to the point on the src cubic specified by t. t must be |
113 0 <= t <= 1.0 | 108 0 <= t <= 1.0 |
114 */ | 109 */ |
115 void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint* locOrNull, | 110 void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint* locOrNull, |
116 SkVector* tangentOrNull, SkVector* curvatureOrNull); | 111 SkVector* tangentOrNull, SkVector* curvatureOrNull); |
117 | 112 |
118 /** Given a src cubic bezier, chop it at the specified t value, | 113 /** Given a src cubic bezier, chop it at the specified t value, |
119 where 0 < t < 1, and return the two new cubics in dst: | 114 where 0 < t < 1, and return the two new cubics in dst: |
120 dst[0..3] and dst[3..6] | 115 dst[0..3] and dst[3..6] |
121 */ | 116 */ |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 private: | 325 private: |
331 enum { | 326 enum { |
332 kQuadCount = 8, // should handle most conics | 327 kQuadCount = 8, // should handle most conics |
333 kPointCount = 1 + 2 * kQuadCount, | 328 kPointCount = 1 + 2 * kQuadCount, |
334 }; | 329 }; |
335 SkAutoSTMalloc<kPointCount, SkPoint> fStorage; | 330 SkAutoSTMalloc<kPointCount, SkPoint> fStorage; |
336 int fQuadCount; // #quads for current usage | 331 int fQuadCount; // #quads for current usage |
337 }; | 332 }; |
338 | 333 |
339 #endif | 334 #endif |
OLD | NEW |