| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  316         return current; |  316         return current; | 
|  317     } |  317     } | 
|  318     SkOpSpan* minSpan = start->starter(end); |  318     SkOpSpan* minSpan = start->starter(end); | 
|  319     int sumWinding = minSpan->windSum(); |  319     int sumWinding = minSpan->windSum(); | 
|  320     if (sumWinding == SK_MinS32) { |  320     if (sumWinding == SK_MinS32) { | 
|  321         SkOpSpanBase* iSpan = end; |  321         SkOpSpanBase* iSpan = end; | 
|  322         SkOpSpanBase* oSpan = start; |  322         SkOpSpanBase* oSpan = start; | 
|  323         do { |  323         do { | 
|  324             bool checkFrom = oSpan->t() < iSpan->t(); |  324             bool checkFrom = oSpan->t() < iSpan->t(); | 
|  325             if ((checkFrom ? iSpan->fromAngle() : iSpan->upCast()->toAngle()) ==
      NULL) { |  325             if ((checkFrom ? iSpan->fromAngle() : iSpan->upCast()->toAngle()) ==
      NULL) { | 
|  326                 iSpan->addSimpleAngle(checkFrom, allocator); |  326                 if (!iSpan->addSimpleAngle(checkFrom, allocator)) { | 
 |  327                     *unsortable = true; | 
 |  328                     return NULL; | 
 |  329                 } | 
|  327             } |  330             } | 
|  328             sumWinding = current->computeSum(oSpan, iSpan, angleIncludeType); |  331             sumWinding = current->computeSum(oSpan, iSpan, angleIncludeType); | 
|  329             SkTSwap(iSpan, oSpan); |  332             SkTSwap(iSpan, oSpan); | 
|  330         } while (sumWinding == SK_MinS32 && iSpan == start); |  333         } while (sumWinding == SK_MinS32 && iSpan == start); | 
|  331     } |  334     } | 
|  332     if (sumWinding != SK_MinS32 && sumWinding != SK_NaN32) { |  335     if (sumWinding != SK_MinS32 && sumWinding != SK_NaN32) { | 
|  333         return current; |  336         return current; | 
|  334     } |  337     } | 
|  335     int contourWinding; |  338     int contourWinding; | 
|  336     int oppContourWinding = 0; |  339     int oppContourWinding = 0; | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  435     /* |  438     /* | 
|  436         check start and end of each contour |  439         check start and end of each contour | 
|  437         if not the same, record them |  440         if not the same, record them | 
|  438         match them up |  441         match them up | 
|  439         connect closest |  442         connect closest | 
|  440         reassemble contour pieces into new path |  443         reassemble contour pieces into new path | 
|  441     */ |  444     */ | 
|  442 void Assemble(const SkPathWriter& path, SkPathWriter* simple) { |  445 void Assemble(const SkPathWriter& path, SkPathWriter* simple) { | 
|  443     SkChunkAlloc allocator(4096);  // FIXME: constant-ize, tune |  446     SkChunkAlloc allocator(4096);  // FIXME: constant-ize, tune | 
|  444     SkOpContour contour; |  447     SkOpContour contour; | 
|  445     SkOpGlobalState globalState(NULL  PATH_OPS_DEBUG_PARAMS(&contour)); |  448     SkOpGlobalState globalState(NULL  SkDEBUGPARAMS(&contour)); | 
|  446 #if DEBUG_PATH_CONSTRUCTION |  449 #if DEBUG_PATH_CONSTRUCTION | 
|  447     SkDebugf("%s\n", __FUNCTION__); |  450     SkDebugf("%s\n", __FUNCTION__); | 
|  448 #endif |  451 #endif | 
|  449     SkOpEdgeBuilder builder(path, &contour, &allocator, &globalState); |  452     SkOpEdgeBuilder builder(path, &contour, &allocator, &globalState); | 
|  450     builder.finish(&allocator); |  453     builder.finish(&allocator); | 
|  451     SkTDArray<const SkOpContour* > runs;  // indices of partial contours |  454     SkTDArray<const SkOpContour* > runs;  // indices of partial contours | 
|  452     const SkOpContour* eContour = builder.head(); |  455     const SkOpContour* eContour = builder.head(); | 
|  453     do { |  456     do { | 
|  454         if (!eContour->count()) { |  457         if (!eContour->count()) { | 
|  455             continue; |  458             continue; | 
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  707         missingCoincidence(contourList, coincidence, allocator); |  710         missingCoincidence(contourList, coincidence, allocator); | 
|  708         if (!coincidence->apply()) { |  711         if (!coincidence->apply()) { | 
|  709             return false; |  712             return false; | 
|  710         } |  713         } | 
|  711     } |  714     } | 
|  712 #if DEBUG_ACTIVE_SPANS |  715 #if DEBUG_ACTIVE_SPANS | 
|  713     DebugShowActiveSpans(*contourList); |  716     DebugShowActiveSpans(*contourList); | 
|  714 #endif |  717 #endif | 
|  715     return true; |  718     return true; | 
|  716 } |  719 } | 
| OLD | NEW |