| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 }; | 433 }; |
| 434 | 434 |
| 435 /* | 435 /* |
| 436 check start and end of each contour | 436 check start and end of each contour |
| 437 if not the same, record them | 437 if not the same, record them |
| 438 match them up | 438 match them up |
| 439 connect closest | 439 connect closest |
| 440 reassemble contour pieces into new path | 440 reassemble contour pieces into new path |
| 441 */ | 441 */ |
| 442 void Assemble(const SkPathWriter& path, SkPathWriter* simple) { | 442 void Assemble(const SkPathWriter& path, SkPathWriter* simple) { |
| 443 SkChunkAlloc allocator(4096); // FIXME: constant-ize, tune | |
| 444 SkOpContour contour; | 443 SkOpContour contour; |
| 445 SkOpGlobalState globalState(NULL PATH_OPS_DEBUG_PARAMS(&contour)); | 444 SkOpGlobalState globalState(NULL PATH_OPS_DEBUG_PARAMS(&contour)); |
| 446 #if DEBUG_PATH_CONSTRUCTION | 445 #if DEBUG_PATH_CONSTRUCTION |
| 447 SkDebugf("%s\n", __FUNCTION__); | 446 SkDebugf("%s\n", __FUNCTION__); |
| 448 #endif | 447 #endif |
| 448 SkChunkAlloc allocator(4096); // FIXME: constant-ize, tune |
| 449 SkOpEdgeBuilder builder(path, &contour, &allocator, &globalState); | 449 SkOpEdgeBuilder builder(path, &contour, &allocator, &globalState); |
| 450 builder.finish(&allocator); | 450 builder.finish(&allocator); |
| 451 SkTDArray<const SkOpContour* > runs; // indices of partial contours | 451 SkTDArray<const SkOpContour* > runs; // indices of partial contours |
| 452 const SkOpContour* eContour = builder.head(); | 452 const SkOpContour* eContour = builder.head(); |
| 453 do { | 453 do { |
| 454 if (!eContour->count()) { | 454 if (!eContour->count()) { |
| 455 continue; | 455 continue; |
| 456 } | 456 } |
| 457 const SkPoint& eStart = eContour->start(); | 457 const SkPoint& eStart = eContour->start(); |
| 458 const SkPoint& eEnd = eContour->end(); | 458 const SkPoint& eEnd = eContour->end(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 missingCoincidence(contourList, coincidence, allocator); | 707 missingCoincidence(contourList, coincidence, allocator); |
| 708 if (!coincidence->apply()) { | 708 if (!coincidence->apply()) { |
| 709 return false; | 709 return false; |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 #if DEBUG_ACTIVE_SPANS | 712 #if DEBUG_ACTIVE_SPANS |
| 713 DebugShowActiveSpans(*contourList); | 713 DebugShowActiveSpans(*contourList); |
| 714 #endif | 714 #endif |
| 715 return true; | 715 return true; |
| 716 } | 716 } |
| OLD | NEW |