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 #ifndef SkPathOpsTSect_DEFINED | 7 #ifndef SkPathOpsTSect_DEFINED |
8 #define SkPathOpsTSect_DEFINED | 8 #define SkPathOpsTSect_DEFINED |
9 | 9 |
10 #include "SkChunkAlloc.h" | 10 #include "SkChunkAlloc.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 420 } |
421 this->validate(); | 421 this->validate(); |
422 #if DEBUG_T_SECT | 422 #if DEBUG_T_SECT |
423 span->validatePerpT(t); | 423 span->validatePerpT(t); |
424 #endif | 424 #endif |
425 } | 425 } |
426 | 426 |
427 template<typename TCurve, typename OppCurve> | 427 template<typename TCurve, typename OppCurve> |
428 double SkTSpan<TCurve, OppCurve>::closestBoundedT(const SkDPoint& pt) const { | 428 double SkTSpan<TCurve, OppCurve>::closestBoundedT(const SkDPoint& pt) const { |
429 double result = -1; | 429 double result = -1; |
430 double closest = FLT_MAX; | 430 double closest = DBL_MAX; |
431 const SkTSpanBounded<OppCurve, TCurve>* testBounded = fBounded; | 431 const SkTSpanBounded<OppCurve, TCurve>* testBounded = fBounded; |
432 while (testBounded) { | 432 while (testBounded) { |
433 const SkTSpan<OppCurve, TCurve>* test = testBounded->fBounded; | 433 const SkTSpan<OppCurve, TCurve>* test = testBounded->fBounded; |
434 double startDist = test->fPart[0].distanceSquared(pt); | 434 double startDist = test->fPart[0].distanceSquared(pt); |
435 if (closest > startDist) { | 435 if (closest > startDist) { |
436 closest = startDist; | 436 closest = startDist; |
437 result = test->fStartT; | 437 result = test->fStartT; |
438 } | 438 } |
439 double endDist = test->fPart[OppCurve::kPointLast].distanceSquared(pt); | 439 double endDist = test->fPart[OppCurve::kPointLast].distanceSquared(pt); |
440 if (closest > endDist) { | 440 if (closest > endDist) { |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 --last; | 2238 --last; |
2239 } else { | 2239 } else { |
2240 intersections->setCoincident(index++); | 2240 intersections->setCoincident(index++); |
2241 } | 2241 } |
2242 intersections->setCoincident(index); | 2242 intersections->setCoincident(index); |
2243 } | 2243 } |
2244 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); | 2244 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); |
2245 } | 2245 } |
2246 | 2246 |
2247 #endif | 2247 #endif |
OLD | NEW |