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

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

Issue 1182493015: pathops coincident fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: all tests (including extended) work Created 5 years, 5 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 | « no previous file | src/pathops/SkOpCoincidence.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 2013 Google Inc. 2 * Copyright 2013 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 SkOpCoincidence_DEFINED 7 #ifndef SkOpCoincidence_DEFINED
8 #define SkOpCoincidence_DEFINED 8 #define SkOpCoincidence_DEFINED
9 9
10 #include "SkOpTAllocator.h" 10 #include "SkOpTAllocator.h"
11 #include "SkOpSpan.h" 11 #include "SkOpSpan.h"
12 #include "SkPathOpsTypes.h"
12 13
13 class SkOpPtT; 14 class SkOpPtT;
14 15
15 struct SkCoincidentSpans { 16 struct SkCoincidentSpans {
16 SkCoincidentSpans* fNext; 17 SkCoincidentSpans* fNext;
17 SkOpPtT* fCoinPtTStart; 18 SkOpPtT* fCoinPtTStart;
18 SkOpPtT* fCoinPtTEnd; 19 SkOpPtT* fCoinPtTEnd;
19 SkOpPtT* fOppPtTStart; 20 SkOpPtT* fOppPtTStart;
20 SkOpPtT* fOppPtTEnd; 21 SkOpPtT* fOppPtTEnd;
21 bool fFlipped; 22 bool fFlipped;
22 23
23 void dump() const; 24 void dump() const;
24 }; 25 };
25 26
26 class SkOpCoincidence { 27 class SkOpCoincidence {
27 public: 28 public:
28 SkOpCoincidence() 29 SkOpCoincidence()
29 : fHead(NULL) { 30 : fHead(NULL)
31 , fTop(NULL)
32 SkDEBUGPARAMS(fDebugState(NULL))
33 {
30 } 34 }
31 35
32 void add(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart, 36 void add(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart,
33 SkOpPtT* oppPtTEnd, SkChunkAlloc* allocator); 37 SkOpPtT* oppPtTEnd, SkChunkAlloc* allocator);
38 void addExpanded(SkChunkAlloc* allocator PATH_OPS_DEBUG_VALIDATE_PARAMS(SkO pGlobalState* ));
34 bool addMissing(SkChunkAlloc* allocator); 39 bool addMissing(SkChunkAlloc* allocator);
35 void addMissing(SkCoincidentSpans* check, SkChunkAlloc* allocator); 40 void addMissing(SkCoincidentSpans* check, SkChunkAlloc* allocator);
36 bool apply(); 41 bool apply();
37 bool contains(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTSta rt, 42 bool contains(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTSta rt,
38 SkOpPtT* oppPtTEnd, bool flipped); 43 SkOpPtT* oppPtTEnd, bool flipped);
44
45 const SkOpAngle* debugAngle(int id) const {
46 return SkDEBUGRELEASE(fDebugState->debugAngle(id), NULL);
47 }
48
49 SkOpContour* debugContour(int id) {
50 return SkDEBUGRELEASE(fDebugState->debugContour(id), NULL);
51 }
52
53 const SkOpPtT* debugPtT(int id) const {
54 return SkDEBUGRELEASE(fDebugState->debugPtT(id), NULL);
55 }
56
57 const SkOpSegment* debugSegment(int id) const {
58 return SkDEBUGRELEASE(fDebugState->debugSegment(id), NULL);
59 }
60
61 void debugSetGlobalState(SkOpGlobalState* debugState) {
62 SkDEBUGCODE(fDebugState = debugState);
63 }
64
39 void debugShowCoincidence() const; 65 void debugShowCoincidence() const;
66
67 const SkOpSpanBase* debugSpan(int id) const {
68 return SkDEBUGRELEASE(fDebugState->debugSpan(id), NULL);
69 }
70
40 void detach(SkCoincidentSpans* ); 71 void detach(SkCoincidentSpans* );
41 void dump() const; 72 void dump() const;
42 void expand(); 73 bool expand();
43 bool extend(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart , 74 bool extend(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart ,
44 SkOpPtT* oppPtTEnd); 75 SkOpPtT* oppPtTEnd);
76 void findOverlaps(SkOpCoincidence* , SkChunkAlloc* allocator) const;
77 void fixAligned();
45 void fixUp(SkOpPtT* deleted, SkOpPtT* kept); 78 void fixUp(SkOpPtT* deleted, SkOpPtT* kept);
79
80 bool isEmpty() const {
81 return !fHead;
82 }
83
46 void mark(); 84 void mark();
47 85
48 private: 86 private:
87 void addIfMissing(const SkCoincidentSpans* outer, SkOpPtT* over1s, SkOpPtT* over1e,
88 SkChunkAlloc* );
49 bool addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over1e, 89 bool addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over1e,
50 const SkOpPtT* over2s, const SkOpPtT* over2e, double tStar t, double tEnd, 90 const SkOpPtT* over2s, const SkOpPtT* over2e,
91 double tStart, double tEnd,
51 SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, 92 SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
52 SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd, 93 SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd,
53 SkChunkAlloc* allocator); 94 SkChunkAlloc* );
95 void addOverlap(SkOpSegment* seg1, SkOpSegment* seg1o, SkOpSegment* seg2, Sk OpSegment* seg2o,
96 SkOpPtT* overS, SkOpPtT* overE, SkChunkAlloc* );
54 bool overlap(const SkOpPtT* coinStart1, const SkOpPtT* coinEnd1, 97 bool overlap(const SkOpPtT* coinStart1, const SkOpPtT* coinEnd1,
55 const SkOpPtT* coinStart2, const SkOpPtT* coinEnd2, 98 const SkOpPtT* coinStart2, const SkOpPtT* coinEnd2,
56 double* overS, double* overE) const; 99 double* overS, double* overE) const;
57 100
101 bool testForCoincidence(const SkCoincidentSpans* outer, SkOpPtT* testS, SkOp PtT* testE) const;
58 SkCoincidentSpans* fHead; 102 SkCoincidentSpans* fHead;
103 SkCoincidentSpans* fTop;
104 SkDEBUGCODE_(SkOpGlobalState* fDebugState);
59 }; 105 };
60 106
61 #endif 107 #endif
OLDNEW
« no previous file with comments | « no previous file | src/pathops/SkOpCoincidence.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698