OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "SkPathOpsPoint.h" | 7 #include "SkPathOpsPoint.h" |
8 #include "SkPathWriter.h" | 8 #include "SkPathWriter.h" |
9 | 9 |
10 // wrap path to keep track of whether the contour is initialized and non-empty | 10 // wrap path to keep track of whether the contour is initialized and non-empty |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return fHasMove; | 83 return fHasMove; |
84 } | 84 } |
85 | 85 |
86 void SkPathWriter::init() { | 86 void SkPathWriter::init() { |
87 fEmpty = true; | 87 fEmpty = true; |
88 fHasMove = false; | 88 fHasMove = false; |
89 fMoved = false; | 89 fMoved = false; |
90 } | 90 } |
91 | 91 |
92 bool SkPathWriter::isClosed() const { | 92 bool SkPathWriter::isClosed() const { |
93 return !fEmpty && fFirstPt == fDefer[1]; | 93 return !fEmpty && SkDPoint::ApproximatelyEqual(fFirstPt, fDefer[1]); |
94 } | 94 } |
95 | 95 |
96 void SkPathWriter::lineTo() { | 96 void SkPathWriter::lineTo() { |
97 if (fDefer[0] == fDefer[1]) { | 97 if (fDefer[0] == fDefer[1]) { |
98 return; | 98 return; |
99 } | 99 } |
100 moveTo(); | 100 moveTo(); |
101 nudge(); | 101 nudge(); |
102 fEmpty = false; | 102 fEmpty = false; |
103 #if DEBUG_PATH_CONSTRUCTION | 103 #if DEBUG_PATH_CONSTRUCTION |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return; | 157 return; |
158 } | 158 } |
159 fFirstPt = fDefer[0]; | 159 fFirstPt = fDefer[0]; |
160 #if DEBUG_PATH_CONSTRUCTION | 160 #if DEBUG_PATH_CONSTRUCTION |
161 SkDebugf("path.moveTo(%1.9g,%1.9g);\n", fDefer[0].fX, fDefer[0].fY); | 161 SkDebugf("path.moveTo(%1.9g,%1.9g);\n", fDefer[0].fX, fDefer[0].fY); |
162 #endif | 162 #endif |
163 fPathPtr->moveTo(fDefer[0].fX, fDefer[0].fY); | 163 fPathPtr->moveTo(fDefer[0].fX, fDefer[0].fY); |
164 fMoved = false; | 164 fMoved = false; |
165 fMoves++; | 165 fMoves++; |
166 } | 166 } |
OLD | NEW |