1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2009 The Android Open Source Project
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci
9cb93a386Sopenharmony_ci#ifndef SkCubicClipper_DEFINED
10cb93a386Sopenharmony_ci#define SkCubicClipper_DEFINED
11cb93a386Sopenharmony_ci
12cb93a386Sopenharmony_ci#include "include/core/SkPoint.h"
13cb93a386Sopenharmony_ci#include "include/core/SkRect.h"
14cb93a386Sopenharmony_ci
15cb93a386Sopenharmony_ci/** This class is initialized with a clip rectangle, and then can be fed cubics,
16cb93a386Sopenharmony_ci    which must already be monotonic in Y.
17cb93a386Sopenharmony_ci
18cb93a386Sopenharmony_ci    In the future, it might return a series of segments, allowing it to clip
19cb93a386Sopenharmony_ci    also in X, to ensure that all segments fit in a finite coordinate system.
20cb93a386Sopenharmony_ci */
21cb93a386Sopenharmony_ciclass SkCubicClipper {
22cb93a386Sopenharmony_cipublic:
23cb93a386Sopenharmony_ci    SkCubicClipper();
24cb93a386Sopenharmony_ci
25cb93a386Sopenharmony_ci    void setClip(const SkIRect& clip);
26cb93a386Sopenharmony_ci
27cb93a386Sopenharmony_ci    bool SK_WARN_UNUSED_RESULT clipCubic(const SkPoint src[4], SkPoint dst[4]);
28cb93a386Sopenharmony_ci
29cb93a386Sopenharmony_ci    static bool SK_WARN_UNUSED_RESULT ChopMonoAtY(const SkPoint pts[4], SkScalar y, SkScalar* t);
30cb93a386Sopenharmony_ciprivate:
31cb93a386Sopenharmony_ci    SkRect      fClip;
32cb93a386Sopenharmony_ci};
33cb93a386Sopenharmony_ci
34cb93a386Sopenharmony_ci#endif  // SkCubicClipper_DEFINED
35