| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "SkGeometry.h" | 7 #include "SkGeometry.h" |
| 8 #include "SkLineParameters.h" | 8 #include "SkLineParameters.h" |
| 9 #include "SkPathOpsConic.h" | 9 #include "SkPathOpsConic.h" |
| 10 #include "SkPathOpsCubic.h" | 10 #include "SkPathOpsCubic.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 SkDebugf("maxCurvature[%d]=%1.9g ", index, maxCurvature[index]); | 270 SkDebugf("maxCurvature[%d]=%1.9g ", index, maxCurvature[index]); |
| 271 SkDPoint pt = cubic.ptAtT(maxCurvature[index]); | 271 SkDPoint pt = cubic.ptAtT(maxCurvature[index]); |
| 272 SkDVector dPt = cubic.dxdyAtT(maxCurvature[index]); | 272 SkDVector dPt = cubic.dxdyAtT(maxCurvature[index]); |
| 273 SkDLine perp = {{pt - dPt, pt + dPt}}; | 273 SkDLine perp = {{pt - dPt, pt + dPt}}; |
| 274 perp.dump(); | 274 perp.dump(); |
| 275 } | 275 } |
| 276 #endif | 276 #endif |
| 277 for (int index = 0; index < roots; ++index) { | 277 for (int index = 0; index < roots; ++index) { |
| 278 if (between(inflectionTs[0], maxCurvature[index], inflectionTs[1
])) { | 278 if (between(inflectionTs[0], maxCurvature[index], inflectionTs[1
])) { |
| 279 *t = maxCurvature[index]; | 279 *t = maxCurvature[index]; |
| 280 return true; | 280 return *t > 0 && *t < 1; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 } else if (infTCount == 1) { | 283 } else if (infTCount == 1) { |
| 284 *t = inflectionTs[0]; | 284 *t = inflectionTs[0]; |
| 285 return *t > 0 && *t < 1; | 285 return *t > 0 && *t < 1; |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 return false; | 288 return false; |
| 289 } | 289 } |
| 290 | 290 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 for (int index = 0; index < roots; ++index) { | 690 for (int index = 0; index < roots; ++index) { |
| 691 double t = startT + (endT - startT) * extremeTs[index]; | 691 double t = startT + (endT - startT) * extremeTs[index]; |
| 692 SkDPoint mid = dCurve.ptAtT(t); | 692 SkDPoint mid = dCurve.ptAtT(t); |
| 693 if (topPt->fY > mid.fY || (topPt->fY == mid.fY && topPt->fX > mid.fX)) { | 693 if (topPt->fY > mid.fY || (topPt->fY == mid.fY && topPt->fX > mid.fX)) { |
| 694 topT = t; | 694 topT = t; |
| 695 *topPt = mid; | 695 *topPt = mid; |
| 696 } | 696 } |
| 697 } | 697 } |
| 698 return topT; | 698 return topT; |
| 699 } | 699 } |
| OLD | NEW |