Chromium Code Reviews| 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" |
| 11 #include "SkPathOpsQuad.h" | 11 #include "SkPathOpsQuad.h" |
| 12 #include "SkIntersections.h" | 12 #include "SkIntersections.h" |
| 13 #include "SkTSort.h" | 13 #include "SkTSort.h" |
| 14 | 14 |
| 15 /* TCurve is either SkDQuadratic or SkDCubic */ | 15 /* TCurve is either SkDQuadratic or SkDCubic */ |
| 16 template<typename TCurve> | 16 template<typename TCurve> |
| 17 class SkTCoincident { | 17 class SkTCoincident { |
| 18 public: | 18 public: |
| 19 SkTCoincident() | 19 SkTCoincident() { |
| 20 : fCoincident(false) { | 20 clear(); |
|
mtklein
2015/04/13 15:55:19
this-> ?
| |
| 21 } | 21 } |
| 22 | 22 |
| 23 void clear() { | 23 void clear() { |
| 24 fPerpT = -1; | 24 fPerpT = -1; |
| 25 fCoincident = false; | 25 fCoincident = false; |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool isCoincident() const { | 28 bool isCoincident() const { |
| 29 return fCoincident; | 29 return fCoincident; |
| 30 } | 30 } |
| 31 | 31 |
| 32 void init() { | 32 void init() { |
| 33 fCoincident = false; | 33 clear(); |
| 34 SkDEBUGCODE(fPerpPt.fX = fPerpPt.fY = SK_ScalarNaN); | 34 SkDEBUGCODE(fPerpPt.fX = fPerpPt.fY = SK_ScalarNaN); |
| 35 SkDEBUGCODE(fPerpT = SK_ScalarNaN); | |
| 36 } | 35 } |
| 37 | 36 |
| 38 void markCoincident() { | 37 void markCoincident() { |
| 39 if (!fCoincident) { | 38 if (!fCoincident) { |
| 40 fPerpT = -1; | 39 fPerpT = -1; |
| 41 } | 40 } |
| 42 fCoincident = true; | 41 fCoincident = true; |
| 43 } | 42 } |
| 44 | 43 |
| 45 const SkDPoint& perpPt() const { | 44 const SkDPoint& perpPt() const { |
| (...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1949 } else if (intersections->isCoincident(index + 1)) { | 1948 } else if (intersections->isCoincident(index + 1)) { |
| 1950 intersections->removeOne(index + 1); | 1949 intersections->removeOne(index + 1); |
| 1951 --last; | 1950 --last; |
| 1952 } else { | 1951 } else { |
| 1953 intersections->setCoincident(index++); | 1952 intersections->setCoincident(index++); |
| 1954 } | 1953 } |
| 1955 intersections->setCoincident(index); | 1954 intersections->setCoincident(index); |
| 1956 } | 1955 } |
| 1957 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); | 1956 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); |
| 1958 } | 1957 } |
| OLD | NEW |