Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SubsetPath Class Referenceabstract

#include <SubsetPath.h>

Inheritance diagram for SubsetPath:
SubsetContours SubsetVerbs

Public Member Functions

 SubsetPath (const SkPath &path)
 
virtual ~SubsetPath ()
 
bool subset (bool testFailed, SkPath *sub)
 

Protected Member Functions

int range (int *end) const
 
virtual SkPath getSubsetPath () const =0
 

Protected Attributes

const SkPathfPath
 
SkTDArray< bool > fSelected
 
int fSubset
 
int fTries
 

Detailed Description

Definition at line 36 of file SubsetPath.h.

Constructor & Destructor Documentation

◆ SubsetPath()

SubsetPath::SubsetPath ( const SkPath path)

Definition at line 16 of file SubsetPath.cpp.

17 : fPath(path)
18 , fSubset(1) {
19}
const SkPath & fPath
Definition SubsetPath.h:45

◆ ~SubsetPath()

virtual SubsetPath::~SubsetPath ( )
inlinevirtual

Definition at line 39 of file SubsetPath.h.

39{}

Member Function Documentation

◆ getSubsetPath()

virtual SkPath SubsetPath::getSubsetPath ( ) const
protectedpure virtual

Implemented in SubsetContours, and SubsetVerbs.

◆ range()

int SubsetPath::range ( int end) const
protected

Definition at line 21 of file SubsetPath.cpp.

21 {
22 int leadingZero = SkCLZ(fSubset);
23 int parts = 1 << (31 - leadingZero);
24 int partIndex = fSubset - parts;
25 SkASSERT(partIndex >= 0);
26 int count = fSelected.size();
27 int start = count * partIndex / parts;
28 *end = count * (partIndex + 1) / parts;
29 return start;
30}
int count
#define SkASSERT(cond)
Definition SkAssert.h:116
static int SkCLZ(uint32_t mask)
Definition SkMathPriv.h:186
int size() const
Definition SkTDArray.h:138
SkTDArray< bool > fSelected
Definition SubsetPath.h:46
glong glong end

◆ subset()

bool SubsetPath::subset ( bool  testFailed,
SkPath sub 
)

Definition at line 32 of file SubsetPath.cpp.

32 {
33 int start, end;
34 if (!testFailed) {
35 start = range(&end);
36 for (; start < end; ++start) {
37 fSelected[start] = true;
38 }
39 }
40 do {
41 do {
42 ++fSubset;
43 start = range(&end);
44 // SkDebugf("%d s=%d e=%d t=%d\n", fSubset, start, end, fTries);
45 if (end - start > 1) {
47 } else if (end - start == 1) {
48 if (--fTries <= 0) {
49 return false;
50 }
51 }
52 } while (start == end);
53 } while (!fSelected[start]);
54 for (; start < end; ++start) {
55 fSelected[start] = false;
56 }
57#if 1
58 SkDebugf("selected: ");
59 for (int index = 0; index < fSelected.size(); ++index) {
60 SkDebugf("%c", fSelected[index] ? 'x' : '-');
61 }
62#endif
63 *sub = getSubsetPath();
64 return true;
65}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
int range(int *end) const
virtual SkPath getSubsetPath() const =0

Member Data Documentation

◆ fPath

const SkPath& SubsetPath::fPath
protected

Definition at line 45 of file SubsetPath.h.

◆ fSelected

SkTDArray<bool> SubsetPath::fSelected
protected

Definition at line 46 of file SubsetPath.h.

◆ fSubset

int SubsetPath::fSubset
protected

Definition at line 47 of file SubsetPath.h.

◆ fTries

int SubsetPath::fTries
protected

Definition at line 48 of file SubsetPath.h.


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