Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: src/pathops/SkOpSpan.h

Issue 2273293004: path ops stream-lining (Closed)
Patch Set: remove commented out code Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pathops/SkOpSegment.cpp ('k') | src/pathops/SkOpSpan.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #ifndef SkOpSpan_DEFINED 7 #ifndef SkOpSpan_DEFINED
8 #define SkOpSpan_DEFINED 8 #define SkOpSpan_DEFINED
9 9
10 #include "SkPathOpsDebug.h" 10 #include "SkPathOpsDebug.h"
(...skipping 11 matching lines...) Expand all
22 22
23 // subset of op span used by terminal span (when t is equal to one) 23 // subset of op span used by terminal span (when t is equal to one)
24 class SkOpPtT { 24 class SkOpPtT {
25 public: 25 public:
26 enum { 26 enum {
27 kIsAlias = 1, 27 kIsAlias = 1,
28 kIsDuplicate = 1 28 kIsDuplicate = 1
29 }; 29 };
30 30
31 // please keep in sync with debugAddOpp() 31 // please keep in sync with debugAddOpp()
32 bool addOpp(SkOpPtT* opp) { 32 void addOpp(SkOpPtT* opp, SkOpPtT* oppPrev) {
33 // find the fOpp ptr to opp
34 SkOpPtT* oppPrev = opp->fNext;
35 if (oppPrev == this) {
36 return false;
37 }
38 while (oppPrev->fNext != opp) {
39 oppPrev = oppPrev->fNext;
40 if (oppPrev == this) {
41 return false;
42 }
43 }
44 SkOpPtT* oldNext = this->fNext; 33 SkOpPtT* oldNext = this->fNext;
45 SkASSERT(this != opp); 34 SkASSERT(this != opp);
46 this->fNext = opp; 35 this->fNext = opp;
47 SkASSERT(oppPrev != oldNext); 36 SkASSERT(oppPrev != oldNext);
48 oppPrev->fNext = oldNext; 37 oppPrev->fNext = oldNext;
49 return true;
50 } 38 }
51 39
52 bool alias() const; 40 bool alias() const;
53 bool coincident() const { return fCoincident; } 41 bool coincident() const { return fCoincident; }
54 bool collapsed(const SkOpPtT* ) const; 42 bool collapsed(const SkOpPtT* ) const;
55 bool contains(const SkOpPtT* ) const; 43 bool contains(const SkOpPtT* ) const;
56 bool contains(const SkOpSegment*, const SkPoint& ) const; 44 bool contains(const SkOpSegment*, const SkPoint& ) const;
57 bool contains(const SkOpSegment*, double t) const; 45 bool contains(const SkOpSegment*, double t) const;
58 const SkOpPtT* contains(const SkOpSegment* ) const; 46 const SkOpPtT* contains(const SkOpSegment* ) const;
59 SkOpContour* contour() const; 47 SkOpContour* contour() const;
60 48
61 int debugID() const { 49 int debugID() const {
62 return SkDEBUGRELEASE(fID, -1); 50 return SkDEBUGRELEASE(fID, -1);
63 } 51 }
64 52
65 bool debugAddOpp(const SkOpPtT* opp) const; 53 void debugAddOpp(const SkOpPtT* opp, const SkOpPtT* oppPrev) const;
66 const SkOpAngle* debugAngle(int id) const; 54 const SkOpAngle* debugAngle(int id) const;
67 const SkOpCoincidence* debugCoincidence() const; 55 const SkOpCoincidence* debugCoincidence() const;
68 bool debugContains(const SkOpPtT* ) const; 56 bool debugContains(const SkOpPtT* ) const;
69 const SkOpPtT* debugContains(const SkOpSegment* check) const; 57 const SkOpPtT* debugContains(const SkOpSegment* check) const;
70 SkOpContour* debugContour(int id); 58 SkOpContour* debugContour(int id);
71 int debugLoopLimit(bool report) const; 59 int debugLoopLimit(bool report) const;
72 bool debugMatchID(int id) const; 60 bool debugMatchID(int id) const;
61 const SkOpPtT* debugOppPrev(const SkOpPtT* opp) const;
73 const SkOpPtT* debugPtT(int id) const; 62 const SkOpPtT* debugPtT(int id) const;
74 void debugResetCoinT() const; 63 void debugResetCoinT() const;
75 const SkOpSegment* debugSegment(int id) const; 64 const SkOpSegment* debugSegment(int id) const;
76 void debugSetCoinT(int ) const; 65 void debugSetCoinT(int ) const;
77 const SkOpSpanBase* debugSpan(int id) const; 66 const SkOpSpanBase* debugSpan(int id) const;
78 void debugValidate() const; 67 void debugValidate() const;
79 68
80 bool deleted() const { 69 bool deleted() const {
81 return fDeleted; 70 return fDeleted;
82 } 71 }
(...skipping 19 matching lines...) Expand all
102 const SkOpPtT* next() const { 91 const SkOpPtT* next() const {
103 return fNext; 92 return fNext;
104 } 93 }
105 94
106 SkOpPtT* next() { 95 SkOpPtT* next() {
107 return fNext; 96 return fNext;
108 } 97 }
109 98
110 bool onEnd() const; 99 bool onEnd() const;
111 100
101 SkOpPtT* oppPrev(SkOpPtT* opp) const {
102 // find the fOpp ptr to opp
103 SkOpPtT* oppPrev = opp->fNext;
104 if (oppPrev == this) {
105 return nullptr;
106 }
107 while (oppPrev->fNext != opp) {
108 oppPrev = oppPrev->fNext;
109 if (oppPrev == this) {
110 return nullptr;
111 }
112 }
113 return oppPrev;
114 }
115
112 static bool Overlaps(const SkOpPtT* s1, const SkOpPtT* e1, const SkOpPtT* s2 , 116 static bool Overlaps(const SkOpPtT* s1, const SkOpPtT* e1, const SkOpPtT* s2 ,
113 const SkOpPtT* e2, const SkOpPtT** sOut, const SkOpPtT** eOut) { 117 const SkOpPtT* e2, const SkOpPtT** sOut, const SkOpPtT** eOut) {
114 const SkOpPtT* start1 = s1->fT < e1->fT ? s1 : e1; 118 const SkOpPtT* start1 = s1->fT < e1->fT ? s1 : e1;
115 const SkOpPtT* start2 = s2->fT < e2->fT ? s2 : e2; 119 const SkOpPtT* start2 = s2->fT < e2->fT ? s2 : e2;
116 *sOut = between(s1->fT, start2->fT, e1->fT) ? start2 120 *sOut = between(s1->fT, start2->fT, e1->fT) ? start2
117 : between(s2->fT, start1->fT, e2->fT) ? start1 : nullptr; 121 : between(s2->fT, start1->fT, e2->fT) ? start1 : nullptr;
118 const SkOpPtT* end1 = s1->fT < e1->fT ? e1 : s1; 122 const SkOpPtT* end1 = s1->fT < e1->fT ? e1 : s1;
119 const SkOpPtT* end2 = s2->fT < e2->fT ? e2 : s2; 123 const SkOpPtT* end2 = s2->fT < e2->fT ? e2 : s2;
120 *eOut = between(s1->fT, end2->fT, e1->fT) ? end2 124 *eOut = between(s1->fT, end2->fT, e1->fT) ? end2
121 : between(s2->fT, end1->fT, e2->fT) ? end1 : nullptr; 125 : between(s2->fT, end1->fT, e2->fT) ? end1 : nullptr;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 int fWindSum; // accumulated from contours surrounding this one. 556 int fWindSum; // accumulated from contours surrounding this one.
553 int fOppSum; // for binary operators: the opposite winding sum 557 int fOppSum; // for binary operators: the opposite winding sum
554 int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident 558 int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident
555 int fOppValue; // normally 0 -- when binary coincident edges combine, opp v alue goes here 559 int fOppValue; // normally 0 -- when binary coincident edges combine, opp v alue goes here
556 int fTopTTry; // specifies direction and t value to try next 560 int fTopTTry; // specifies direction and t value to try next
557 bool fDone; // if set, this span to next higher T has been processed 561 bool fDone; // if set, this span to next higher T has been processed
558 mutable bool fAlreadyAdded; 562 mutable bool fAlreadyAdded;
559 }; 563 };
560 564
561 #endif 565 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkOpSegment.cpp ('k') | src/pathops/SkOpSpan.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698