OLD | NEW |
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 | 12 |
13 class SkOpPtT; | 13 class SkOpPtT; |
14 | 14 |
15 struct SkCoincidentSpans { | 15 struct SkCoincidentSpans { |
16 SkCoincidentSpans* fNext; | 16 SkCoincidentSpans* fNext; |
17 SkOpPtT* fCoinPtTStart; | 17 SkOpPtT* fCoinPtTStart; |
18 SkOpPtT* fCoinPtTEnd; | 18 SkOpPtT* fCoinPtTEnd; |
19 SkOpPtT* fOppPtTStart; | 19 SkOpPtT* fOppPtTStart; |
20 SkOpPtT* fOppPtTEnd; | 20 SkOpPtT* fOppPtTEnd; |
21 bool fFlipped; | 21 bool fFlipped; |
| 22 |
| 23 void dump() const; |
22 }; | 24 }; |
23 | 25 |
24 class SkOpCoincidence { | 26 class SkOpCoincidence { |
25 public: | 27 public: |
26 SkOpCoincidence() | 28 SkOpCoincidence() |
27 : fHead(NULL) { | 29 : fHead(NULL) { |
28 } | 30 } |
29 | 31 |
30 void add(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart, | 32 void add(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart, |
31 SkOpPtT* oppPtTEnd, bool flipped, SkChunkAlloc* allocator); | 33 SkOpPtT* oppPtTEnd, SkChunkAlloc* allocator); |
32 void apply(); | 34 bool addMissing(SkChunkAlloc* allocator); |
| 35 bool apply(); |
33 bool contains(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTSta
rt, | 36 bool contains(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTSta
rt, |
34 SkOpPtT* oppPtTEnd, bool flipped); | 37 SkOpPtT* oppPtTEnd, bool flipped); |
| 38 void detach(SkCoincidentSpans* ); |
35 void dump() const; | 39 void dump() const; |
| 40 void expand(); |
| 41 void fixUp(SkOpPtT* deleted, SkOpPtT* kept); |
36 void mark(); | 42 void mark(); |
37 | 43 |
| 44 private: |
| 45 bool addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over1e, |
| 46 const SkOpPtT* over2s, const SkOpPtT* over2e, double tStar
t, double tEnd, |
| 47 SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, |
| 48 SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd, |
| 49 SkChunkAlloc* allocator); |
| 50 bool overlap(const SkOpPtT* coinStart1, const SkOpPtT* coinEnd1, |
| 51 const SkOpPtT* coinStart2, const SkOpPtT* coinEnd2, |
| 52 double* overS, double* overE) const; |
| 53 |
38 SkCoincidentSpans* fHead; | 54 SkCoincidentSpans* fHead; |
39 }; | 55 }; |
40 | 56 |
41 #endif | 57 #endif |
OLD | NEW |