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 "SkAddIntersections.h" | 7 #include "SkAddIntersections.h" |
8 #include "SkOpCoincidence.h" | 8 #include "SkOpCoincidence.h" |
9 #include "SkOpEdgeBuilder.h" | 9 #include "SkOpEdgeBuilder.h" |
10 #include "SkPathOpsCommon.h" | 10 #include "SkPathOpsCommon.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 SkASSERT(unsortable || !current->done()); | 30 SkASSERT(unsortable || !current->done()); |
31 SkOpSpanBase* nextStart = start; | 31 SkOpSpanBase* nextStart = start; |
32 SkOpSpanBase* nextEnd = end; | 32 SkOpSpanBase* nextEnd = end; |
33 SkOpSegment* next = current->findNextWinding(&chase, &nextSt
art, &nextEnd, | 33 SkOpSegment* next = current->findNextWinding(&chase, &nextSt
art, &nextEnd, |
34 &unsortable); | 34 &unsortable); |
35 if (!next) { | 35 if (!next) { |
36 if (!unsortable && simple->hasMove() | 36 if (!unsortable && simple->hasMove() |
37 && current->verb() != SkPath::kLine_Verb | 37 && current->verb() != SkPath::kLine_Verb |
38 && !simple->isClosed()) { | 38 && !simple->isClosed()) { |
39 if (!current->addCurveTo(start, end, simple)) { | 39 // FIXME: put in the next two lines to avoid handlin
g already added |
| 40 if (start->starter(end)->checkAlreadyAdded()) { |
| 41 simple->close(); |
| 42 } else if (!current->addCurveTo(start, end, simple))
{ |
40 return false; | 43 return false; |
41 } | 44 } |
42 if (!simple->isClosed()) { | 45 if (!simple->isClosed()) { |
43 SkPathOpsDebug::ShowActiveSpans(contourList); | 46 SkPathOpsDebug::ShowActiveSpans(contourList); |
44 } | 47 } |
45 } | 48 } |
46 break; | 49 break; |
47 } | 50 } |
48 #if DEBUG_FLOW | 51 #if DEBUG_FLOW |
49 SkDebugf("%s current id=%d from=(%1.9g,%1.9g) to=(%1.9g,%1.9g)\n", _
_FUNCTION__, | 52 SkDebugf("%s current id=%d from=(%1.9g,%1.9g) to=(%1.9g,%1.9g)\n", _
_FUNCTION__, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 235 } |
233 if (scaleFactor > 1) { | 236 if (scaleFactor > 1) { |
234 ScalePath(*result, scaleFactor, result); | 237 ScalePath(*result, scaleFactor, result); |
235 } | 238 } |
236 return true; | 239 return true; |
237 } | 240 } |
238 | 241 |
239 bool Simplify(const SkPath& path, SkPath* result) { | 242 bool Simplify(const SkPath& path, SkPath* result) { |
240 return SimplifyDebug(path, result SkDEBUGPARAMS(true) SkDEBUGPARAMS(nullptr
)); | 243 return SimplifyDebug(path, result SkDEBUGPARAMS(true) SkDEBUGPARAMS(nullptr
)); |
241 } | 244 } |
OLD | NEW |