blob: cb8bb3a8d760f63b155d168a624f4ddba0a93022 [file] [log] [blame]
Chris Dalton419a94d2017-08-28 10:24:22 -06001/*
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
13struct 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 */
26bool GrCCPRChopMonotonicQuadratics(const SkPoint& startPt, const SkPoint& controlPt,
27 const SkPoint& endPt, SkPoint dst[5]);
28
29#endif