Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkQuadClipper.h
Go to the documentation of this file.
1/*
2 * Copyright 2009 The Android Open Source Project
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
9#ifndef SkQuadClipper_DEFINED
10#define SkQuadClipper_DEFINED
11
12#include "include/core/SkPath.h"
14#include "include/core/SkRect.h"
16
17/** This class is initialized with a clip rectangle, and then can be fed quads,
18 which must already be monotonic in Y.
19
20 In the future, it might return a series of segments, allowing it to clip
21 also in X, to ensure that all segments fit in a finite coordinate system.
22 */
24public:
26
27 void setClip(const SkIRect& clip);
28
29 bool clipQuad(const SkPoint src[3], SkPoint dst[3]);
30
31private:
32 SkRect fClip;
33};
34
35/** Iterator that returns the clipped segements of a quad clipped to a rect.
36 The segments will be either lines or quads (based on SkPath::Verb), and
37 will all be monotonic in Y
38 */
40public:
41 bool clipQuad(const SkPoint pts[3], const SkRect& clip);
42 bool clipCubic(const SkPoint pts[4], const SkRect& clip);
43
45
46private:
47 SkPoint* fCurrPoint;
48 SkPath::Verb* fCurrVerb;
49
50 enum {
51 kMaxVerbs = 13,
52 kMaxPoints = 32
53 };
54 SkPoint fPoints[kMaxPoints];
55 SkPath::Verb fVerbs[kMaxVerbs];
56
57 void clipMonoQuad(const SkPoint srcPts[3], const SkRect& clip);
58 void clipMonoCubic(const SkPoint srcPts[4], const SkRect& clip);
59 void appendVLine(SkScalar x, SkScalar y0, SkScalar y1, bool reverse);
60 void appendQuad(const SkPoint pts[3], bool reverse);
61 void appendCubic(const SkPoint pts[4], bool reverse);
62};
63
64#ifdef SK_DEBUG
65 void sk_assert_monotonic_x(const SkPoint pts[], int count);
66 void sk_assert_monotonic_y(const SkPoint pts[], int count);
67#else
68 #define sk_assert_monotonic_x(pts, count)
69 #define sk_assert_monotonic_y(pts, count)
70#endif
71
72#endif
int count
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
#define sk_assert_monotonic_y(pts, count)
#define sk_assert_monotonic_x(pts, count)
bool clipQuad(const SkPoint pts[3], const SkRect &clip)
SkPath::Verb next(SkPoint pts[])
bool clipCubic(const SkPoint pts[4], const SkRect &clip)
void setClip(const SkIRect &clip)
bool clipQuad(const SkPoint src[3], SkPoint dst[3])
float SkScalar
Definition extension.cpp:12
double x