blob: c52eabe460235bb68b8e88c9cb6ac39930305e19 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
turk@google.com4896f9e2009-03-02 20:00:00 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2009 The Android Open Source Project
turk@google.com4896f9e2009-03-02 20:00:00 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
turk@google.com4896f9e2009-03-02 20:00:00 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
turk@google.com4896f9e2009-03-02 20:00:00 +000010#ifndef SkCubicClipper_DEFINED
11#define SkCubicClipper_DEFINED
12
13#include "SkPoint.h"
14#include "SkRect.h"
15
16/** This class is initialized with a clip rectangle, and then can be fed cubics,
17 which must already be monotonic in Y.
turk@google.com7d3a58a2009-03-04 01:33:35 +000018
turk@google.com4896f9e2009-03-02 20:00:00 +000019 In the future, it might return a series of segments, allowing it to clip
20 also in X, to ensure that all segments fit in a finite coordinate system.
21 */
22class SkCubicClipper {
23public:
24 SkCubicClipper();
turk@google.com7d3a58a2009-03-04 01:33:35 +000025
turk@google.com4896f9e2009-03-02 20:00:00 +000026 void setClip(const SkIRect& clip);
27
28 bool clipCubic(const SkPoint src[4], SkPoint dst[4]);
29
30private:
31 SkRect fClip;
32};
33
34#endif // SkCubicClipper_DEFINED