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 "SkChunkAlloc.h" | 8 #include "SkChunkAlloc.h" |
9 #include "SkPathOpsBounds.h" | 9 #include "SkPathOpsBounds.h" |
10 #include "SkPathOpsRect.h" | 10 #include "SkPathOpsRect.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 fCoincident = cPt.approximatelyEqual(fPerpPt); | 342 fCoincident = cPt.approximatelyEqual(fPerpPt); |
343 #if DEBUG_T_SECT | 343 #if DEBUG_T_SECT |
344 if (fCoincident) { | 344 if (fCoincident) { |
345 SkDebugf(""); // allow setting breakpoint | 345 SkDebugf(""); // allow setting breakpoint |
346 } | 346 } |
347 #endif | 347 #endif |
348 } | 348 } |
349 | 349 |
350 template<typename TCurve, typename OppCurve> | 350 template<typename TCurve, typename OppCurve> |
351 void SkTSpan<TCurve, OppCurve>::addBounded(SkTSpan<OppCurve, TCurve>* span, SkCh
unkAlloc* heap) { | 351 void SkTSpan<TCurve, OppCurve>::addBounded(SkTSpan<OppCurve, TCurve>* span, SkCh
unkAlloc* heap) { |
352 SkTSpanBounded<OppCurve, TCurve>* bounded = SkNEW_PLACEMENT(heap->allocThrow
( | 352 SkTSpanBounded<OppCurve, TCurve>* bounded = new (heap->allocThrow( |
353 sizeof(SkTSpanBounded<OppCurve, TCurve>)), (SkTSpanBounded<OppCurve,
TCurve>)); | 353 sizeof(SkTSpanBounded<OppCurve, TCurve>)))(SkTSpanBounded<OppCurve,
TCurve>); |
354 bounded->fBounded = span; | 354 bounded->fBounded = span; |
355 bounded->fNext = fBounded; | 355 bounded->fNext = fBounded; |
356 fBounded = bounded; | 356 fBounded = bounded; |
357 } | 357 } |
358 | 358 |
359 template<typename TCurve, typename OppCurve> | 359 template<typename TCurve, typename OppCurve> |
360 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::addFollowing( | 360 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::addFollowing( |
361 SkTSpan<TCurve, OppCurve>* prior) { | 361 SkTSpan<TCurve, OppCurve>* prior) { |
362 SkTSpan<TCurve, OppCurve>* result = this->addOne(); | 362 SkTSpan<TCurve, OppCurve>* result = this->addOne(); |
363 result->fStartT = prior ? prior->fEndT : 0; | 363 result->fStartT = prior ? prior->fEndT : 0; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 } | 822 } |
823 | 823 |
824 template<typename TCurve, typename OppCurve> | 824 template<typename TCurve, typename OppCurve> |
825 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::addOne() { | 825 SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::addOne() { |
826 SkTSpan<TCurve, OppCurve>* result; | 826 SkTSpan<TCurve, OppCurve>* result; |
827 if (fDeleted) { | 827 if (fDeleted) { |
828 result = fDeleted; | 828 result = fDeleted; |
829 result->reset(); | 829 result->reset(); |
830 fDeleted = result->fNext; | 830 fDeleted = result->fNext; |
831 } else { | 831 } else { |
832 result = SkNEW_PLACEMENT(fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurv
e>)), | 832 result = new (fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurve>)))( |
833 (SkTSpan<TCurve, OppCurve>)); | 833 SkTSpan<TCurve, OppCurve>); |
834 result->fBounded = NULL; | 834 result->fBounded = NULL; |
835 #if DEBUG_T_SECT | 835 #if DEBUG_T_SECT |
836 ++fDebugAllocatedCount; | 836 ++fDebugAllocatedCount; |
837 #endif | 837 #endif |
838 } | 838 } |
839 result->fHasPerp = false; | 839 result->fHasPerp = false; |
840 result->fDeleted = false; | 840 result->fDeleted = false; |
841 ++fActiveCount; | 841 ++fActiveCount; |
842 PATH_OPS_DEBUG_T_SECT_CODE(result->fID = fDebugCount++ * 2 + fID); | 842 PATH_OPS_DEBUG_T_SECT_CODE(result->fID = fDebugCount++ * 2 + fID); |
843 SkDEBUGCODE(result->fDebugSect = this); | 843 SkDEBUGCODE(result->fDebugSect = this); |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 } else if (intersections->isCoincident(index + 1)) { | 2086 } else if (intersections->isCoincident(index + 1)) { |
2087 intersections->removeOne(index + 1); | 2087 intersections->removeOne(index + 1); |
2088 --last; | 2088 --last; |
2089 } else { | 2089 } else { |
2090 intersections->setCoincident(index++); | 2090 intersections->setCoincident(index++); |
2091 } | 2091 } |
2092 intersections->setCoincident(index); | 2092 intersections->setCoincident(index); |
2093 } | 2093 } |
2094 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); | 2094 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); |
2095 } | 2095 } |
OLD | NEW |