Flutter Engine
The Flutter Engine
SkIntersectionHelper.h
Go to the documentation of this file.
1/*
2 * Copyright 2012 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#ifndef SkIntersectionHelper_DEFINED
8#define SkIntersectionHelper_DEFINED
9
10#include "include/core/SkPath.h"
13
14#ifdef SK_DEBUG
16#endif
17
19public:
27 };
28
29 bool advance() {
30 fSegment = fSegment->next();
31 return fSegment != nullptr;
32 }
33
34 SkScalar bottom() const {
35 return bounds().fBottom;
36 }
37
38 const SkPathOpsBounds& bounds() const {
39 return fSegment->bounds();
40 }
41
43 return fSegment->contour();
44 }
45
47 fSegment = contour->first();
48 }
49
50 SkScalar left() const {
51 return bounds().fLeft;
52 }
53
54 const SkPoint* pts() const {
55 return fSegment->pts();
56 }
57
58 SkScalar right() const {
59 return bounds().fRight;
60 }
61
63 return fSegment;
64 }
65
67 SegmentType type = (SegmentType) fSegment->verb();
68 if (type != kLine_Segment) {
69 return type;
70 }
71 if (fSegment->isHorizontal()) {
73 }
74 if (fSegment->isVertical()) {
76 }
77 return kLine_Segment;
78 }
79
80 bool startAfter(const SkIntersectionHelper& after) {
81 fSegment = after.fSegment->next();
82 return fSegment != nullptr;
83 }
84
85 SkScalar top() const {
86 return bounds().fTop;
87 }
88
89 SkScalar weight() const {
90 return fSegment->weight();
91 }
92
93 SkScalar x() const {
94 return bounds().fLeft;
95 }
96
97 bool xFlipped() const {
98 return x() != pts()[0].fX;
99 }
100
101 SkScalar y() const {
102 return bounds().fTop;
103 }
104
105 bool yFlipped() const {
106 return y() != pts()[0].fY;
107 }
108
109private:
110 SkOpSegment* fSegment;
111};
112
113#endif
GLenum type
const SkPathOpsBounds & bounds() const
bool startAfter(const SkIntersectionHelper &after)
SkOpSegment * segment() const
void init(SkOpContour *contour)
SkOpContour * contour() const
SegmentType segmentType() const
const SkPoint * pts() const
SkPath::Verb verb() const
Definition: SkOpSegment.h:419
const SkPathOpsBounds & bounds() const
Definition: SkOpSegment.h:109
SkScalar weight() const
Definition: SkOpSegment.h:432
const SkPoint * pts() const
Definition: SkOpSegment.h:327
bool isVertical() const
Definition: SkOpSegment.h:269
SkOpSegment * next() const
Definition: SkOpSegment.h:304
bool isHorizontal() const
Definition: SkOpSegment.h:261
SkOpContour * contour() const
Definition: SkOpSegment.h:130
@ kConic_Verb
Definition: SkPath.h:1469
@ kCubic_Verb
Definition: SkPath.h:1470
@ kQuad_Verb
Definition: SkPath.h:1468
@ kLine_Verb
Definition: SkPath.h:1467
float SkScalar
Definition: extension.cpp:12
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15