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 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 float By = pts[1].y(); | 123 float By = pts[1].y(); |
124 float Cy = pts[2].y(); | 124 float Cy = pts[2].y(); |
125 float Dy = pts[3].y(); | 125 float Dy = pts[3].y(); |
126 | 126 |
127 // precompute coefficients for derivative | 127 // precompute coefficients for derivative |
128 xCoeff[0] = Sk8f(3.0f*(-Ax + 3.0f*(Bx - Cx) + Dx)); | 128 xCoeff[0] = Sk8f(3.0f*(-Ax + 3.0f*(Bx - Cx) + Dx)); |
129 xCoeff[1] = Sk8f(3.0f*(2.0f*(Ax - 2.0f*Bx + Cx))); | 129 xCoeff[1] = Sk8f(3.0f*(2.0f*(Ax - 2.0f*Bx + Cx))); |
130 xCoeff[2] = Sk8f(3.0f*(-Ax + Bx)); | 130 xCoeff[2] = Sk8f(3.0f*(-Ax + Bx)); |
131 | 131 |
132 yCoeff[0] = Sk8f(3.0f*(-Ay + 3.0f*(By - Cy) + Dy)); | 132 yCoeff[0] = Sk8f(3.0f*(-Ay + 3.0f*(By - Cy) + Dy)); |
133 yCoeff[1] = Sk8f(3.0f * -Ay + By + 2.0f*(Ay - 2.0f*By + Cy)); | 133 yCoeff[1] = Sk8f(3.0f*(2.0f*(Ay - 2.0f*By + Cy))); |
reed1
2016/08/16 21:19:35
this seems fine. two nits:
1. don't need 3.0f whe
| |
134 yCoeff[2] = Sk8f(3.0f*(-Ay + By)); | 134 yCoeff[2] = Sk8f(3.0f*(-Ay + By)); |
135 } | 135 } |
136 break; | 136 break; |
137 case kConic_SegType: | 137 case kConic_SegType: |
138 UNIMPLEMENTED; | 138 UNIMPLEMENTED; |
139 break; | 139 break; |
140 default: | 140 default: |
141 UNIMPLEMENTED; | 141 UNIMPLEMENTED; |
142 } | 142 } |
143 } | 143 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 if (time) { | 301 if (time) { |
302 *time = t; | 302 *time = t; |
303 } | 303 } |
304 if (pos) { | 304 if (pos) { |
305 *pos = evaluate(fPts, fSegType, t); | 305 *pos = evaluate(fPts, fSegType, t); |
306 } | 306 } |
307 if (tan) { | 307 if (tan) { |
308 *tan = evaluateDerivative(fPts, fSegType, t); | 308 *tan = evaluateDerivative(fPts, fSegType, t); |
309 } | 309 } |
310 } | 310 } |
OLD | NEW |