Chris Dalton | 419a94d | 2017-08-28 10:24:22 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrGrCCPRGeometry_DEFINED |
| 9 | #define GrGrCCPRGeometry_DEFINED |
| 10 | |
| 11 | #include "SkTypes.h" |
| 12 | |
| 13 | struct SkPoint; |
| 14 | |
| 15 | /* |
| 16 | * Ensures that a quadratic bezier is monotonic with respect to the vector between its endpoints |
| 17 | * [P2 - P0]. In the event that the curve is not monotonic, it is chopped into two segments that |
| 18 | * are. This should be rare for well-behaved curves in the real world. |
| 19 | * |
| 20 | * NOTE: This must be done in device space, since an affine transformation can change whether a |
| 21 | * curve is monotonic. |
| 22 | * |
| 23 | * Returns false if the curve was already monotonic. |
| 24 | * true if it was chopped into two monotonic segments, now contained in dst. |
| 25 | */ |
| 26 | bool GrCCPRChopMonotonicQuadratics(const SkPoint& startPt, const SkPoint& controlPt, |
| 27 | const SkPoint& endPt, SkPoint dst[5]); |
| 28 | |
| 29 | #endif |