Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
SkDConic Struct Reference

#include <SkPathOpsConic.h>

Public Member Functions

bool collapsed () const
 
bool controlsInside () const
 
void debugInit ()
 
void debugSet (const SkDPoint *pts, SkScalar weight)
 
SkDConic flip () const
 
const SkDConicset (const SkPoint pts[kPointCount], SkScalar weight SkDEBUGPARAMS(SkOpGlobalState *state=nullptr))
 
const SkDPointoperator[] (int n) const
 
SkDPointoperator[] (int n)
 
void align (int endIndex, SkDPoint *dstPt) const
 
SkDVector dxdyAtT (double t) const
 
bool hullIntersects (const SkDQuad &quad, bool *isLinear) const
 
bool hullIntersects (const SkDConic &conic, bool *isLinear) const
 
bool hullIntersects (const SkDCubic &cubic, bool *isLinear) const
 
bool isLinear (int startIndex, int endIndex) const
 
bool monotonicInX () const
 
bool monotonicInY () const
 
void otherPts (int oddMan, const SkDPoint *endPt[2]) const
 
SkDPoint ptAtT (double t) const
 
SkDConic subDivide (double t1, double t2) const
 
void subDivide (double t1, double t2, SkDConic *c) const
 
SkDPoint subDivide (const SkDPoint &a, const SkDPoint &c, double t1, double t2, SkScalar *weight) const
 
void dump () const
 
void dumpID (int id) const
 
void dumpInner () const
 

Static Public Member Functions

static bool IsConic ()
 
static int AddValidTs (double s[], int realRoots, double *t)
 
static int FindExtrema (const double src[], SkScalar weight, double tValue[1])
 
static int maxIntersections ()
 
static int pointCount ()
 
static int pointLast ()
 
static int RootsReal (double A, double B, double C, double t[2])
 
static int RootsValidT (const double A, const double B, const double C, double s[2])
 
static SkDConic SubDivide (const SkPoint a[kPointCount], SkScalar weight, double t1, double t2)
 
static SkDPoint SubDivide (const SkPoint pts[kPointCount], SkScalar weight, const SkDPoint &a, const SkDPoint &c, double t1, double t2, SkScalar *newWeight)
 

Public Attributes

SkDQuad fPts
 
SkScalar fWeight
 

Static Public Attributes

static const int kPointCount = 3
 
static const int kPointLast = kPointCount - 1
 
static const int kMaxIntersections = 4
 

Detailed Description

Definition at line 26 of file SkPathOpsConic.h.

Member Function Documentation

◆ AddValidTs()

static int SkDConic::AddValidTs ( double  s[],
int  realRoots,
double *  t 
)
inlinestatic

Definition at line 71 of file SkPathOpsConic.h.

71 {
72 return SkDQuad::AddValidTs(s, realRoots, t);
73 }
struct MyStruct s
static int AddValidTs(double s[], int realRoots, double *t)

◆ align()

void SkDConic::align ( int  endIndex,
SkDPoint dstPt 
) const
inline

Definition at line 75 of file SkPathOpsConic.h.

75 {
76 fPts.align(endIndex, dstPt);
77 }
SkDQuad fPts
void align(int endIndex, SkDPoint *dstPt) const

◆ collapsed()

bool SkDConic::collapsed ( ) const
inline

Definition at line 34 of file SkPathOpsConic.h.

34 {
35 return fPts.collapsed();
36 }
bool collapsed() const

◆ controlsInside()

bool SkDConic::controlsInside ( ) const
inline

Definition at line 38 of file SkPathOpsConic.h.

38 {
39 return fPts.controlsInside();
40 }
bool controlsInside() const

◆ debugInit()

void SkDConic::debugInit ( )
inline

Definition at line 42 of file SkPathOpsConic.h.

42 {
44 fWeight = 0;
45 }
SkScalar fWeight
void debugInit()

◆ debugSet()

void SkDConic::debugSet ( const SkDPoint pts,
SkScalar  weight 
)

Definition at line 717 of file SkPathOpsDebug.cpp.

717 {
718 fPts.debugSet(pts);
719 fWeight = weight;
720}
void debugSet(const SkDPoint *pts)

◆ dump()

void SkDConic::dump ( ) const

Definition at line 88 of file PathOpsDebug.cpp.

88 {
89 dumpInner();
90 SkDebugf("},\n");
91}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
void dumpInner() const

◆ dumpID()

void SkDConic::dumpID ( int  id) const

Definition at line 93 of file PathOpsDebug.cpp.

93 {
94 dumpInner();
95 DumpID(id);
96}
void DumpID(const SkDConic &, int id)

◆ dumpInner()

void SkDConic::dumpInner ( ) const

Definition at line 98 of file PathOpsDebug.cpp.

98 {
99 SkDebugf("{");
100 fPts.dumpInner();
101 SkDebugf("}}, %1.9gf", fWeight);
102}
void dumpInner() const

◆ dxdyAtT()

SkDVector SkDConic::dxdyAtT ( double  t) const

Definition at line 57 of file SkPathOpsConic.cpp.

57 {
59 conic_eval_tan(&fPts[0].fX, fWeight, t),
60 conic_eval_tan(&fPts[0].fY, fWeight, t)
61 };
62 if (result.fX == 0 && result.fY == 0) {
63 if (zero_or_one(t)) {
64 result = fPts[2] - fPts[0];
65 } else {
66 // incomplete
67 SkDebugf("!k");
68 }
69 }
70 return result;
71}
static double conic_eval_tan(const double coord[], SkScalar w, double t)
bool zero_or_one(double x)
GAsyncResult * result

◆ FindExtrema()

int SkDConic::FindExtrema ( const double  src[],
SkScalar  weight,
double  tValue[1] 
)
static

Definition at line 39 of file SkPathOpsConic.cpp.

39 {
40 double coeff[3];
41 conic_deriv_coeff(src, w, coeff);
42
43 double tValues[2];
44 int roots = SkDQuad::RootsValidT(coeff[0], coeff[1], coeff[2], tValues);
45 // In extreme cases, the number of roots returned can be 2. Pathops
46 // will fail later on, so there's no advantage to plumbing in an error
47 // return here.
48 // SkASSERT(0 == roots || 1 == roots);
49
50 if (1 == roots) {
51 t[0] = tValues[0];
52 return 1;
53 }
54 return 0;
55}
static void conic_deriv_coeff(const SkScalar src[], SkScalar w, SkScalar coeff[3])
SkScalar w
static int RootsValidT(const double A, const double B, const double C, double s[2])

◆ flip()

SkDConic SkDConic::flip ( ) const
inline

Definition at line 49 of file SkPathOpsConic.h.

49 {
50 SkDConic result = {{{fPts[2], fPts[1], fPts[0]}
51 SkDEBUGPARAMS(fPts.fDebugGlobalState) }, fWeight};
52 return result;
53 }
#define SkDEBUGPARAMS(...)

◆ hullIntersects() [1/3]

bool SkDConic::hullIntersects ( const SkDConic conic,
bool *  isLinear 
) const
inline

Definition at line 86 of file SkPathOpsConic.h.

86 {
87 return fPts.hullIntersects(conic.fPts, isLinear);
88 }
AI float conic(float tolerance, const SkPoint pts[], float w, const VectorXform &vectorXform=VectorXform())
bool isLinear(int startIndex, int endIndex) const
bool hullIntersects(const SkDQuad &, bool *isLinear) const

◆ hullIntersects() [2/3]

bool SkDConic::hullIntersects ( const SkDCubic cubic,
bool *  isLinear 
) const

Definition at line 91 of file SkPathOpsConic.cpp.

91 {
92 return cubic.hullIntersects(*this, isLinear);
93}
AI float cubic(float precision, const SkPoint pts[], const VectorXform &vectorXform=VectorXform())

◆ hullIntersects() [3/3]

bool SkDConic::hullIntersects ( const SkDQuad quad,
bool *  isLinear 
) const
inline

Definition at line 82 of file SkPathOpsConic.h.

82 {
83 return fPts.hullIntersects(quad, isLinear);
84 }

◆ IsConic()

static bool SkDConic::IsConic ( )
inlinestatic

Definition at line 59 of file SkPathOpsConic.h.

59{ return true; }

◆ isLinear()

bool SkDConic::isLinear ( int  startIndex,
int  endIndex 
) const
inline

Definition at line 92 of file SkPathOpsConic.h.

92 {
93 return fPts.isLinear(startIndex, endIndex);
94 }
bool isLinear(int startIndex, int endIndex) const

◆ maxIntersections()

static int SkDConic::maxIntersections ( )
inlinestatic

Definition at line 96 of file SkPathOpsConic.h.

96{ return kMaxIntersections; }
static const int kMaxIntersections

◆ monotonicInX()

bool SkDConic::monotonicInX ( ) const
inline

Definition at line 98 of file SkPathOpsConic.h.

98 {
99 return fPts.monotonicInX();
100 }
bool monotonicInX() const

◆ monotonicInY()

bool SkDConic::monotonicInY ( ) const
inline

Definition at line 102 of file SkPathOpsConic.h.

102 {
103 return fPts.monotonicInY();
104 }
bool monotonicInY() const

◆ operator[]() [1/2]

SkDPoint & SkDConic::operator[] ( int  n)
inline

Definition at line 69 of file SkPathOpsConic.h.

69{ return fPts[n]; }

◆ operator[]() [2/2]

const SkDPoint & SkDConic::operator[] ( int  n) const
inline

Definition at line 68 of file SkPathOpsConic.h.

68{ return fPts[n]; }

◆ otherPts()

void SkDConic::otherPts ( int  oddMan,
const SkDPoint endPt[2] 
) const
inline

Definition at line 106 of file SkPathOpsConic.h.

106 {
107 fPts.otherPts(oddMan, endPt);
108 }
void otherPts(int oddMan, const SkDPoint *endPt[2]) const

◆ pointCount()

static int SkDConic::pointCount ( )
inlinestatic

Definition at line 110 of file SkPathOpsConic.h.

110{ return kPointCount; }
static const int kPointCount

◆ pointLast()

static int SkDConic::pointLast ( )
inlinestatic

Definition at line 111 of file SkPathOpsConic.h.

111{ return kPointLast; }
static const int kPointLast

◆ ptAtT()

SkDPoint SkDConic::ptAtT ( double  t) const

Definition at line 95 of file SkPathOpsConic.cpp.

95 {
96 if (t == 0) {
97 return fPts[0];
98 }
99 if (t == 1) {
100 return fPts[2];
101 }
102 double denominator = conic_eval_denominator(fWeight, t);
103 SkDPoint result = {
104 sk_ieee_double_divide(conic_eval_numerator(&fPts[0].fX, fWeight, t), denominator),
106 };
107 return result;
108}
static constexpr double sk_ieee_double_divide(double numer, double denom)
static double conic_eval_numerator(const SkScalar src[], SkScalar w, SkScalar t)
Definition SkPath.cpp:2743
static double conic_eval_denominator(SkScalar w, SkScalar t)
Definition SkPath.cpp:2754

◆ RootsReal()

static int SkDConic::RootsReal ( double  A,
double  B,
double  C,
double  t[2] 
)
inlinestatic

Definition at line 114 of file SkPathOpsConic.h.

114 {
115 return SkDQuad::RootsReal(A, B, C, t);
116 }
static int RootsReal(double A, double B, double C, double t[2])

◆ RootsValidT()

static int SkDConic::RootsValidT ( const double  A,
const double  B,
const double  C,
double  s[2] 
)
inlinestatic

Definition at line 118 of file SkPathOpsConic.h.

118 {
119 return SkDQuad::RootsValidT(A, B, C, s);
120 }

◆ set()

const SkDConic & SkDConic::set ( const SkPoint  pts[kPointCount],
SkScalar weight   SkDEBUGPARAMSSkOpGlobalState *state=nullptr 
)
inline

Definition at line 61 of file SkPathOpsConic.h.

62 {
64 fWeight = weight;
65 return *this;
66 }
AtkStateType state
const SkDQuad & set(const SkPoint pts[kPointCount] SkDEBUGPARAMS(SkOpGlobalState *state=nullptr))

◆ subDivide() [1/3]

SkDPoint SkDConic::subDivide ( const SkDPoint a,
const SkDPoint c,
double  t1,
double  t2,
SkScalar weight 
) const

Definition at line 176 of file SkPathOpsConic.cpp.

177 {
178 SkDConic chopped = this->subDivide(t1, t2);
179 *weight = chopped.fWeight;
180 return chopped[1];
181}
SkDConic subDivide(double t1, double t2) const

◆ SubDivide() [1/2]

static SkDConic SkDConic::SubDivide ( const SkPoint  a[kPointCount],
SkScalar  weight,
double  t1,
double  t2 
)
inlinestatic

Definition at line 125 of file SkPathOpsConic.h.

125 {
127 conic.set(a, weight);
128 return conic.subDivide(t1, t2);
129 }
struct MyStruct a[10]

◆ SubDivide() [2/2]

static SkDPoint SkDConic::SubDivide ( const SkPoint  pts[kPointCount],
SkScalar  weight,
const SkDPoint a,
const SkDPoint c,
double  t1,
double  t2,
SkScalar newWeight 
)
inlinestatic

Definition at line 134 of file SkPathOpsConic.h.

136 {
138 conic.set(pts, weight);
139 return conic.subDivide(a, c, t1, t2, newWeight);
140 }

◆ subDivide() [2/3]

SkDConic SkDConic::subDivide ( double  t1,
double  t2 
) const

Definition at line 131 of file SkPathOpsConic.cpp.

131 {
132 double ax, ay, az;
133 if (t1 == 0) {
134 ax = fPts[0].fX;
135 ay = fPts[0].fY;
136 az = 1;
137 } else if (t1 != 1) {
138 ax = conic_eval_numerator(&fPts[0].fX, fWeight, t1);
139 ay = conic_eval_numerator(&fPts[0].fY, fWeight, t1);
141 } else {
142 ax = fPts[2].fX;
143 ay = fPts[2].fY;
144 az = 1;
145 }
146 double midT = (t1 + t2) / 2;
147 double dx = conic_eval_numerator(&fPts[0].fX, fWeight, midT);
148 double dy = conic_eval_numerator(&fPts[0].fY, fWeight, midT);
149 double dz = conic_eval_denominator(fWeight, midT);
150 double cx, cy, cz;
151 if (t2 == 1) {
152 cx = fPts[2].fX;
153 cy = fPts[2].fY;
154 cz = 1;
155 } else if (t2 != 0) {
156 cx = conic_eval_numerator(&fPts[0].fX, fWeight, t2);
157 cy = conic_eval_numerator(&fPts[0].fY, fWeight, t2);
159 } else {
160 cx = fPts[0].fX;
161 cy = fPts[0].fY;
162 cz = 1;
163 }
164 double bx = 2 * dx - (ax + cx) / 2;
165 double by = 2 * dy - (ay + cy) / 2;
166 double bz = 2 * dz - (az + cz) / 2;
167 if (!bz) {
168 bz = 1; // if bz is 0, weight is 0, control point has no effect: any value will do
169 }
170 SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}}
171 SkDEBUGPARAMS(fPts.fDebugGlobalState) },
172 SkDoubleToScalar(bz / sqrt(az * cz)) };
173 return dst;
174}
#define SkDoubleToScalar(x)
Definition SkScalar.h:64
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition SkRecords.h:208
dst
Definition cp.py:12
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
Definition SkVx.h:706

◆ subDivide() [3/3]

void SkDConic::subDivide ( double  t1,
double  t2,
SkDConic c 
) const
inline

Definition at line 123 of file SkPathOpsConic.h.

123{ *c = this->subDivide(t1, t2); }

Member Data Documentation

◆ fPts

SkDQuad SkDConic::fPts

Definition at line 31 of file SkPathOpsConic.h.

◆ fWeight

SkScalar SkDConic::fWeight

Definition at line 32 of file SkPathOpsConic.h.

◆ kMaxIntersections

const int SkDConic::kMaxIntersections = 4
static

Definition at line 29 of file SkPathOpsConic.h.

◆ kPointCount

const int SkDConic::kPointCount = 3
static

Definition at line 27 of file SkPathOpsConic.h.

◆ kPointLast

const int SkDConic::kPointLast = kPointCount - 1
static

Definition at line 28 of file SkPathOpsConic.h.


The documentation for this struct was generated from the following files: