Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkOpAngle.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 SkOpAngle_DEFINED
8#define SkOpAngle_DEFINED
9
10#include "include/core/SkPath.h"
16
17#if DEBUG_ANGLE
19#endif
20
21#include <cstdint>
22
23class SkOpCoincidence;
24class SkOpContour;
25class SkOpPtT;
26class SkOpSegment;
27class SkOpSpan;
28class SkOpSpanBase;
29struct SkDPoint;
30struct SkDVector;
31
32class SkOpAngle {
33public:
40
41 const SkOpAngle* debugAngle(int id) const;
42 const SkOpCoincidence* debugCoincidence() const;
43 SkOpContour* debugContour(int id) const;
44
45 int debugID() const {
46 return SkDEBUGRELEASE(fID, -1);
47 }
48
49#if DEBUG_SORT
50 void debugLoop() const;
51#endif
52
53#if DEBUG_ANGLE
54 bool debugCheckCoincidence() const { return fCheckCoincidence; }
55 void debugCheckNearCoincidence() const;
56 SkString debugPart() const;
57#endif
58 const SkOpPtT* debugPtT(int id) const;
59 const SkOpSegment* debugSegment(int id) const;
60 int debugSign() const;
61 const SkOpSpanBase* debugSpan(int id) const;
62 void debugValidate() const;
63 void debugValidateNext() const; // in debug builds, verify that angle loop is uncorrupted
64 double distEndRatio(double dist) const;
65 // available to testing only
66 void dump() const;
67 void dumpCurves() const;
68 void dumpLoop() const;
69 void dumpOne(bool functionHeader) const;
70 void dumpTo(const SkOpSegment* fromSeg, const SkOpAngle* ) const;
71 void dumpTest() const;
72
73 SkOpSpanBase* end() const {
74 return fEnd;
75 }
76
77 bool insert(SkOpAngle* );
78 SkOpSpanBase* lastMarked() const;
79 bool loopContains(const SkOpAngle* ) const;
80 int loopCount() const;
81
82 SkOpAngle* next() const {
83 return fNext;
84 }
85
86 SkOpAngle* previous() const;
87 SkOpSegment* segment() const;
89
91 fLastMarked = marked;
92 }
93
95 return fStart;
96 }
97
99
100 bool tangentsAmbiguous() const {
101 return fTangentsAmbiguous;
102 }
103
104 bool unorderable() const {
105 return fUnorderable;
106 }
107
108private:
109 bool after(SkOpAngle* test);
110 void alignmentSameSide(const SkOpAngle* test, int* order) const;
111 bool checkCrossesZero() const;
112 bool checkParallel(SkOpAngle* );
113 bool computeSector();
114 int convexHullOverlaps(const SkOpAngle* );
115 bool endToSide(const SkOpAngle* rh, bool* inside) const;
116 bool endsIntersect(SkOpAngle* );
117 int findSector(SkPath::Verb verb, double x, double y) const;
118 SkOpGlobalState* globalState() const;
119 int lineOnOneSide(const SkDPoint& origin, const SkDVector& line, const SkOpAngle* test,
120 bool useOriginal) const;
121 int lineOnOneSide(const SkOpAngle* test, bool useOriginal);
122 int linesOnOriginalSide(const SkOpAngle* test);
123 bool merge(SkOpAngle* );
124 double midT() const;
125 bool midToSide(const SkOpAngle* rh, bool* inside) const;
126 bool oppositePlanes(const SkOpAngle* rh) const;
127 int orderable(SkOpAngle* rh); // false == this < rh ; true == this > rh; -1 == unorderable
128 void setSector();
129 void setSpans();
130 bool tangentsDiverge(const SkOpAngle* rh, double s0xt0);
131
132 SkDCurve fOriginalCurvePart; // the curve from start to end
133 SkDCurveSweep fPart; // the curve from start to end offset as needed
134 double fSide;
135 SkLineParameters fTangentHalf; // used only to sort a pair of lines or line-like sections
136 SkOpAngle* fNext;
137 SkOpSpanBase* fLastMarked;
138 SkOpSpanBase* fStart;
139 SkOpSpanBase* fEnd;
140 SkOpSpanBase* fComputedEnd;
141 int fSectorMask;
142 int8_t fSectorStart; // in 32nds of a circle
143 int8_t fSectorEnd;
144 bool fUnorderable;
145 bool fComputeSector;
146 bool fComputedSector;
147 bool fCheckCoincidence;
148 bool fTangentsAmbiguous;
149 SkDEBUGCODE(int fID;)
150
151 friend class PathOpsAngleTester;
152};
153
154
155
156#endif
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
#define SkDEBUGRELEASE(a, b)
double distEndRatio(double dist) const
bool unorderable() const
Definition SkOpAngle.h:104
bool loopContains(const SkOpAngle *) const
SkOpSegment * segment() const
SkOpSpanBase * end() const
Definition SkOpAngle.h:73
int loopCount() const
const SkOpAngle * debugAngle(int id) const
SkOpAngle * next() const
Definition SkOpAngle.h:82
void dumpCurves() const
void dumpOne(bool functionHeader) const
const SkOpSegment * debugSegment(int id) const
void debugValidate() const
SkOpContour * debugContour(int id) const
const SkOpCoincidence * debugCoincidence() const
int debugID() const
Definition SkOpAngle.h:45
void setLastMarked(SkOpSpanBase *marked)
Definition SkOpAngle.h:90
void dumpTo(const SkOpSegment *fromSeg, const SkOpAngle *) const
void debugValidateNext() const
void dumpLoop() const
bool tangentsAmbiguous() const
Definition SkOpAngle.h:100
SkOpAngle * previous() const
@ kUnaryWinding
Definition SkOpAngle.h:35
@ kBinarySingle
Definition SkOpAngle.h:37
int debugSign() const
SkOpSpanBase * start() const
Definition SkOpAngle.h:94
bool insert(SkOpAngle *)
const SkOpSpanBase * debugSpan(int id) const
SkOpSpan * starter()
void dumpTest() const
SkOpSpanBase * lastMarked() const
void dump() const
const SkOpPtT * debugPtT(int id) const
double y
double x