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

#include <SkPathOpsRect.h>

Public Member Functions

void add (const SkDPoint &pt)
 
bool contains (const SkDPoint &pt) const
 
void debugInit ()
 
bool intersects (const SkDRect &r) const
 
void set (const SkDPoint &pt)
 
double width () const
 
double height () const
 
void setBounds (const SkDConic &curve)
 
void setBounds (const SkDConic &curve, const SkDConic &sub, double tStart, double tEnd)
 
void setBounds (const SkDCubic &curve)
 
void setBounds (const SkDCubic &curve, const SkDCubic &sub, double tStart, double tEnd)
 
void setBounds (const SkDQuad &curve)
 
void setBounds (const SkDQuad &curve, const SkDQuad &sub, double tStart, double tEnd)
 
void setBounds (const SkTCurve &curve)
 
bool valid () const
 

Public Attributes

double fLeft
 
double fTop
 
double fRight
 
double fBottom
 

Detailed Description

Definition at line 21 of file SkPathOpsRect.h.

Member Function Documentation

◆ add()

void SkDRect::add ( const SkDPoint pt)
inline

Definition at line 24 of file SkPathOpsRect.h.

24 {
25 fLeft = std::min(fLeft, pt.fX);
26 fTop = std::min(fTop, pt.fY);
27 fRight = std::max(fRight, pt.fX);
28 fBottom = std::max(fBottom, pt.fY);
29 }
double fTop
double fRight
double fBottom
double fLeft

◆ contains()

bool SkDRect::contains ( const SkDPoint pt) const
inline

Definition at line 31 of file SkPathOpsRect.h.

31 {
34 }
bool approximately_between(double a, double b, double c)

◆ debugInit()

void SkDRect::debugInit ( )

Definition at line 722 of file SkPathOpsDebug.cpp.

722 {
724}
#define SK_ScalarNaN
Definition SkScalar.h:28

◆ height()

double SkDRect::height ( ) const
inline

Definition at line 55 of file SkPathOpsRect.h.

55 {
56 return fBottom - fTop;
57 }

◆ intersects()

bool SkDRect::intersects ( const SkDRect r) const
inline

Definition at line 38 of file SkPathOpsRect.h.

38 {
41 SkASSERT(r.fLeft <= r.fRight);
42 SkASSERT(r.fTop <= r.fBottom);
43 return r.fLeft <= fRight && fLeft <= r.fRight && r.fTop <= fBottom && fTop <= r.fBottom;
44 }
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ set()

void SkDRect::set ( const SkDPoint pt)
inline

Definition at line 46 of file SkPathOpsRect.h.

46 {
47 fLeft = fRight = pt.fX;
48 fTop = fBottom = pt.fY;
49 }

◆ setBounds() [1/7]

void SkDRect::setBounds ( const SkDConic curve)
inline

Definition at line 59 of file SkPathOpsRect.h.

59 {
60 setBounds(curve, curve, 0, 1);
61 }
void setBounds(const SkDConic &curve)

◆ setBounds() [2/7]

void SkDRect::setBounds ( const SkDConic curve,
const SkDConic sub,
double  tStart,
double  tEnd 
)

Definition at line 31 of file SkPathOpsRect.cpp.

31 {
32 set(sub[0]);
33 add(sub[2]);
34 double tValues[2];
35 int roots = 0;
36 if (!sub.monotonicInX()) {
37 roots = SkDConic::FindExtrema(&sub[0].fX, sub.fWeight, tValues);
38 }
39 if (!sub.monotonicInY()) {
40 roots += SkDConic::FindExtrema(&sub[0].fY, sub.fWeight, &tValues[roots]);
41 }
42 for (int index = 0; index < roots; ++index) {
43 double t = startT + (endT - startT) * tValues[index];
44 add(curve.ptAtT(t));
45 }
46}
SkDPoint ptAtT(double t) const
static int FindExtrema(const double src[], SkScalar weight, double tValue[1])
bool monotonicInY() const
bool monotonicInX() const
SkScalar fWeight
void add(const SkDPoint &pt)
void set(const SkDPoint &pt)

◆ setBounds() [3/7]

void SkDRect::setBounds ( const SkDCubic curve)
inline

Definition at line 65 of file SkPathOpsRect.h.

65 {
66 setBounds(curve, curve, 0, 1);
67 }

◆ setBounds() [4/7]

void SkDRect::setBounds ( const SkDCubic curve,
const SkDCubic sub,
double  tStart,
double  tEnd 
)

Definition at line 48 of file SkPathOpsRect.cpp.

48 {
49 set(sub[0]);
50 add(sub[3]);
51 double tValues[4];
52 int roots = 0;
53 if (!sub.monotonicInX()) {
54 roots = SkDCubic::FindExtrema(&sub[0].fX, tValues);
55 }
56 if (!sub.monotonicInY()) {
57 roots += SkDCubic::FindExtrema(&sub[0].fY, &tValues[roots]);
58 }
59 for (int index = 0; index < roots; ++index) {
60 double t = startT + (endT - startT) * tValues[index];
61 add(curve.ptAtT(t));
62 }
63}
bool monotonicInX() const
bool monotonicInY() const
static int FindExtrema(const double src[], double tValue[2])
SkDPoint ptAtT(double t) const

◆ setBounds() [5/7]

void SkDRect::setBounds ( const SkDQuad curve)
inline

Definition at line 71 of file SkPathOpsRect.h.

71 {
72 setBounds(curve, curve, 0, 1);
73 }

◆ setBounds() [6/7]

void SkDRect::setBounds ( const SkDQuad curve,
const SkDQuad sub,
double  tStart,
double  tEnd 
)

Definition at line 14 of file SkPathOpsRect.cpp.

14 {
15 set(sub[0]);
16 add(sub[2]);
17 double tValues[2];
18 int roots = 0;
19 if (!sub.monotonicInX()) {
20 roots = SkDQuad::FindExtrema(&sub[0].fX, tValues);
21 }
22 if (!sub.monotonicInY()) {
23 roots += SkDQuad::FindExtrema(&sub[0].fY, &tValues[roots]);
24 }
25 for (int index = 0; index < roots; ++index) {
26 double t = startT + (endT - startT) * tValues[index];
27 add(curve.ptAtT(t));
28 }
29}
bool monotonicInY() const
bool monotonicInX() const
static int FindExtrema(const double src[], double tValue[1])
SkDPoint ptAtT(double t) const

◆ setBounds() [7/7]

void SkDRect::setBounds ( const SkTCurve curve)

Definition at line 65 of file SkPathOpsRect.cpp.

65 {
66 curve.setBounds(this);
67}
virtual void setBounds(SkDRect *) const =0

◆ valid()

bool SkDRect::valid ( ) const
inline

Definition at line 79 of file SkPathOpsRect.h.

79 {
80 return fLeft <= fRight && fTop <= fBottom;
81 }

◆ width()

double SkDRect::width ( ) const
inline

Definition at line 51 of file SkPathOpsRect.h.

51 {
52 return fRight - fLeft;
53 }

Member Data Documentation

◆ fBottom

double SkDRect::fBottom

Definition at line 22 of file SkPathOpsRect.h.

◆ fLeft

double SkDRect::fLeft

Definition at line 22 of file SkPathOpsRect.h.

◆ fRight

double SkDRect::fRight

Definition at line 22 of file SkPathOpsRect.h.

◆ fTop

double SkDRect::fTop

Definition at line 22 of file SkPathOpsRect.h.


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