| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 7 |
| 8 #include "SkPathOpsTSect.h" | 8 #include "SkPathOpsTSect.h" |
| 9 | 9 |
| 10 template<typename TCurve, typename OppCurve> | 10 template<typename TCurve, typename OppCurve> |
| 11 void SkTCoincident<TCurve, OppCurve>::dump() const { | 11 void SkTCoincident<TCurve, OppCurve>::dump() const { |
| 12 SkDebugf("t=%1.9g pt=(%1.9g,%1.9g)%s\n", fPerpT, fPerpPt.fX, fPerpPt.fY, | 12 SkDebugf("t=%1.9g pt=(%1.9g,%1.9g)%s\n", fPerpT, fPerpPt.fX, fPerpPt.fY, |
| 13 fCoincident ? " coincident" : ""); | 13 fCoincident ? " coincident" : ""); |
| 14 } | 14 } |
| 15 | 15 |
| 16 template<typename TCurve, typename OppCurve> | 16 template<typename TCurve, typename OppCurve> |
| 17 const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugSpan(int id) co
nst { | 17 const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugSpan(int id) co
nst { |
| 18 const SkTSpan<TCurve, OppCurve>* test = fHead; | 18 const SkTSpan<TCurve, OppCurve>* test = fHead; |
| 19 do { | 19 do { |
| 20 if (test->debugID() == id) { | 20 if (test->debugID() == id) { |
| 21 return test; | 21 return test; |
| 22 } | 22 } |
| 23 } while ((test = test->next())); | 23 } while ((test = test->next())); |
| 24 return NULL; | 24 return nullptr; |
| 25 } | 25 } |
| 26 | 26 |
| 27 template<typename TCurve, typename OppCurve> | 27 template<typename TCurve, typename OppCurve> |
| 28 const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugT(double t) con
st { | 28 const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugT(double t) con
st { |
| 29 const SkTSpan<TCurve, OppCurve>* test = fHead; | 29 const SkTSpan<TCurve, OppCurve>* test = fHead; |
| 30 const SkTSpan<TCurve, OppCurve>* closest = NULL; | 30 const SkTSpan<TCurve, OppCurve>* closest = nullptr; |
| 31 double bestDist = DBL_MAX; | 31 double bestDist = DBL_MAX; |
| 32 do { | 32 do { |
| 33 if (between(test->fStartT, t, test->fEndT)) { | 33 if (between(test->fStartT, t, test->fEndT)) { |
| 34 return test; | 34 return test; |
| 35 } | 35 } |
| 36 double testDist = SkTMin(fabs(test->fStartT - t), fabs(test->fEndT - t))
; | 36 double testDist = SkTMin(fabs(test->fStartT - t), fabs(test->fEndT - t))
; |
| 37 if (bestDist > testDist) { | 37 if (bestDist > testDist) { |
| 38 bestDist = testDist; | 38 bestDist = testDist; |
| 39 closest = test; | 39 closest = test; |
| 40 } | 40 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } while ((test = test->next())); | 125 } while ((test = test->next())); |
| 126 } | 126 } |
| 127 | 127 |
| 128 template<typename TCurve, typename OppCurve> | 128 template<typename TCurve, typename OppCurve> |
| 129 void SkTSect<TCurve, OppCurve>::dumpCurves() const { | 129 void SkTSect<TCurve, OppCurve>::dumpCurves() const { |
| 130 dumpCommonCurves(fHead); | 130 dumpCommonCurves(fHead); |
| 131 } | 131 } |
| 132 | 132 |
| 133 template<typename TCurve, typename OppCurve> | 133 template<typename TCurve, typename OppCurve> |
| 134 const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugSpan(int id) co
nst { | 134 const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugSpan(int id) co
nst { |
| 135 return SkDEBUGRELEASE(fDebugSect->debugSpan(id), NULL); | 135 return SkDEBUGRELEASE(fDebugSect->debugSpan(id), nullptr); |
| 136 } | 136 } |
| 137 | 137 |
| 138 template<typename TCurve, typename OppCurve> | 138 template<typename TCurve, typename OppCurve> |
| 139 const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugT(double t) con
st { | 139 const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugT(double t) con
st { |
| 140 return SkDEBUGRELEASE(fDebugSect->debugT(t), NULL); | 140 return SkDEBUGRELEASE(fDebugSect->debugT(t), nullptr); |
| 141 } | 141 } |
| 142 | 142 |
| 143 template<typename TCurve, typename OppCurve> | 143 template<typename TCurve, typename OppCurve> |
| 144 void SkTSpan<TCurve, OppCurve>::dump() const { | 144 void SkTSpan<TCurve, OppCurve>::dump() const { |
| 145 dumpID(); | 145 dumpID(); |
| 146 SkDebugf("=(%g,%g) [", fStartT, fEndT); | 146 SkDebugf("=(%g,%g) [", fStartT, fEndT); |
| 147 const SkTSpanBounded<OppCurve, TCurve>* testBounded = fBounded; | 147 const SkTSpanBounded<OppCurve, TCurve>* testBounded = fBounded; |
| 148 while (testBounded) { | 148 while (testBounded) { |
| 149 const SkTSpan<OppCurve, TCurve>* span = testBounded->fBounded; | 149 const SkTSpan<OppCurve, TCurve>* span = testBounded->fBounded; |
| 150 const SkTSpanBounded<OppCurve, TCurve>* next = testBounded->fNext; | 150 const SkTSpanBounded<OppCurve, TCurve>* next = testBounded->fNext; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 template<typename TCurve, typename OppCurve> | 182 template<typename TCurve, typename OppCurve> |
| 183 void SkTSpan<TCurve, OppCurve>::dumpID() const { | 183 void SkTSpan<TCurve, OppCurve>::dumpID() const { |
| 184 if (fCoinStart.isCoincident()) { | 184 if (fCoinStart.isCoincident()) { |
| 185 SkDebugf("%c", '*'); | 185 SkDebugf("%c", '*'); |
| 186 } | 186 } |
| 187 SkDebugf("%d", debugID()); | 187 SkDebugf("%d", debugID()); |
| 188 if (fCoinEnd.isCoincident()) { | 188 if (fCoinEnd.isCoincident()) { |
| 189 SkDebugf("%c", '*'); | 189 SkDebugf("%c", '*'); |
| 190 } | 190 } |
| 191 } | 191 } |
| OLD | NEW |