| 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 "SkOpEdgeBuilder.h" | 8 #include "SkOpEdgeBuilder.h" |
| 9 #include "SkPathOpsCommon.h" | 9 #include "SkPathOpsCommon.h" |
| 10 #include "SkPathWriter.h" | 10 #include "SkPathWriter.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 subtrahend = &one; | 263 subtrahend = &one; |
| 264 op = kDifference_PathOp; | 264 op = kDifference_PathOp; |
| 265 } | 265 } |
| 266 #if DEBUG_SORT || DEBUG_SWAP_TOP | 266 #if DEBUG_SORT || DEBUG_SWAP_TOP |
| 267 SkPathOpsDebug::gSortCount = SkPathOpsDebug::gSortCountDefault; | 267 SkPathOpsDebug::gSortCount = SkPathOpsDebug::gSortCountDefault; |
| 268 #endif | 268 #endif |
| 269 // turn path into list of segments | 269 // turn path into list of segments |
| 270 SkTArray<SkOpContour> contours; | 270 SkTArray<SkOpContour> contours; |
| 271 // FIXME: add self-intersecting cubics' T values to segment | 271 // FIXME: add self-intersecting cubics' T values to segment |
| 272 SkOpEdgeBuilder builder(*minuend, contours); | 272 SkOpEdgeBuilder builder(*minuend, contours); |
| 273 if (builder.unparseable()) { |
| 274 return false; |
| 275 } |
| 273 const int xorMask = builder.xorMask(); | 276 const int xorMask = builder.xorMask(); |
| 274 builder.addOperand(*subtrahend); | 277 builder.addOperand(*subtrahend); |
| 275 if (!builder.finish()) { | 278 if (!builder.finish()) { |
| 276 return false; | 279 return false; |
| 277 } | 280 } |
| 278 result->reset(); | 281 result->reset(); |
| 279 result->setFillType(fillType); | 282 result->setFillType(fillType); |
| 280 const int xorOpMask = builder.xorMask(); | 283 const int xorOpMask = builder.xorMask(); |
| 281 SkTArray<SkOpContour*, true> contourList; | 284 SkTArray<SkOpContour*, true> contourList; |
| 282 MakeContourList(contours, contourList, xorMask == kEvenOdd_PathOpsMask, | 285 MakeContourList(contours, contourList, xorMask == kEvenOdd_PathOpsMask, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 { // if some edges could not be resolved, assemble remaining fragments | 317 { // if some edges could not be resolved, assemble remaining fragments |
| 315 SkPath temp; | 318 SkPath temp; |
| 316 temp.setFillType(fillType); | 319 temp.setFillType(fillType); |
| 317 SkPathWriter assembled(temp); | 320 SkPathWriter assembled(temp); |
| 318 Assemble(wrapper, &assembled); | 321 Assemble(wrapper, &assembled); |
| 319 *result = *assembled.nativePath(); | 322 *result = *assembled.nativePath(); |
| 320 result->setFillType(fillType); | 323 result->setFillType(fillType); |
| 321 } | 324 } |
| 322 return true; | 325 return true; |
| 323 } | 326 } |
| OLD | NEW |