| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrPathUtils.h" | 8 #include "GrPathUtils.h" |
| 9 | 9 |
| 10 #include "GrPoint.h" | 10 #include "GrPoint.h" |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 632 |
| 633 m[0] = ls * ms * ms; | 633 m[0] = ls * ms * ms; |
| 634 m[1] = (ms * (ls * (2.f * mt - 3.f * ms) + lt * ms))/-3.f; | 634 m[1] = (ms * (ls * (2.f * mt - 3.f * ms) + lt * ms))/-3.f; |
| 635 m[2] = ((mt - ms) * (ls * (mt - 3.f * ms) + 2.f * lt * ms))/3.f; | 635 m[2] = ((mt - ms) * (ls * (mt - 3.f * ms) + 2.f * lt * ms))/3.f; |
| 636 m[3] = -1.f * (lt - ls) * (mt - ms) * (mt - ms); | 636 m[3] = -1.f * (lt - ls) * (mt - ms) * (mt - ms); |
| 637 | 637 |
| 638 | 638 |
| 639 // If (d0 < 0 && sign(k1) > 0) || (d0 > 0 && sign(k1) < 0), | 639 // If (d0 < 0 && sign(k1) > 0) || (d0 > 0 && sign(k1) < 0), |
| 640 // we need to flip the orientation of our curve. | 640 // we need to flip the orientation of our curve. |
| 641 // This is done by negating the k and l values | 641 // This is done by negating the k and l values |
| 642 if ( (d[0] < 0 && k[1] < 0) || (d[0] > 0 && k[1] > 0)) { | 642 if ( (d[0] < 0 && k[1] > 0) || (d[0] > 0 && k[1] < 0)) { |
| 643 for (int i = 0; i < 4; ++i) { | 643 for (int i = 0; i < 4; ++i) { |
| 644 k[i] = -k[i]; | 644 k[i] = -k[i]; |
| 645 l[i] = -l[i]; | 645 l[i] = -l[i]; |
| 646 } | 646 } |
| 647 } | 647 } |
| 648 } | 648 } |
| 649 | 649 |
| 650 static void set_cusp_klm(const SkScalar d[3], SkScalar k[4], SkScalar l[4], SkSc
alar m[4]) { | 650 static void set_cusp_klm(const SkScalar d[3], SkScalar k[4], SkScalar l[4], SkSc
alar m[4]) { |
| 651 const SkScalar ls = d[2]; | 651 const SkScalar ls = d[2]; |
| 652 const SkScalar lt = 3.f * d[1]; | 652 const SkScalar lt = 3.f * d[1]; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 set_loop_klm(d, controlK, controlL, controlM); | 831 set_loop_klm(d, controlK, controlL, controlM); |
| 832 } else if (kCusp_CubicType == cType) { | 832 } else if (kCusp_CubicType == cType) { |
| 833 SkASSERT(0.f == d[0]); | 833 SkASSERT(0.f == d[0]); |
| 834 set_cusp_klm(d, controlK, controlL, controlM); | 834 set_cusp_klm(d, controlK, controlL, controlM); |
| 835 } else if (kQuadratic_CubicType == cType) { | 835 } else if (kQuadratic_CubicType == cType) { |
| 836 set_quadratic_klm(d, controlK, controlL, controlM); | 836 set_quadratic_klm(d, controlK, controlL, controlM); |
| 837 } | 837 } |
| 838 | 838 |
| 839 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); | 839 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); |
| 840 } | 840 } |
| OLD | NEW |