| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkOpContour.h" | 7 #include "SkOpContour.h" |
| 8 #include "SkOpTAllocator.h" | 8 #include "SkOpTAllocator.h" |
| 9 #include "SkPathWriter.h" | 9 #include "SkPathWriter.h" |
| 10 #include "SkReduceOrder.h" | 10 #include "SkReduceOrder.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void SkOpContour::toPath(SkPathWriter* path) const { | 62 void SkOpContour::toPath(SkPathWriter* path) const { |
| 63 const SkPoint& pt = fHead.pts()[0]; | 63 const SkPoint& pt = fHead.pts()[0]; |
| 64 path->deferredMove(pt); | 64 path->deferredMove(pt); |
| 65 const SkOpSegment* segment = &fHead; | 65 const SkOpSegment* segment = &fHead; |
| 66 do { | 66 do { |
| 67 segment->addCurveTo(segment->head(), segment->tail(), path, true); | 67 segment->addCurveTo(segment->head(), segment->tail(), path, true); |
| 68 } while ((segment = segment->next())); | 68 } while ((segment = segment->next())); |
| 69 path->close(); | 69 path->close(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SkOpContour::topSortableSegment(const SkPoint& topLeft, SkPoint* bestXY, | 72 void SkOpContour::topSortableSegment(const SkDPoint& topLeft, SkDPoint* bestXY, |
| 73 SkOpSegment** topStart) { | 73 SkOpSegment** topStart) { |
| 74 int segmentCount = fSortedSegments.count(); | 74 int segmentCount = fSortedSegments.count(); |
| 75 SkASSERT(segmentCount > 0); | 75 SkASSERT(segmentCount > 0); |
| 76 int sortedIndex = fFirstSorted; | 76 int sortedIndex = fFirstSorted; |
| 77 fDone = true; // may be cleared below | 77 fDone = true; // may be cleared below |
| 78 for ( ; sortedIndex < segmentCount; ++sortedIndex) { | 78 for ( ; sortedIndex < segmentCount; ++sortedIndex) { |
| 79 SkOpSegment* testSegment = fSortedSegments[sortedIndex]; | 79 SkOpSegment* testSegment = fSortedSegments[sortedIndex]; |
| 80 if (testSegment->done()) { | 80 if (testSegment->done()) { |
| 81 if (sortedIndex == fFirstSorted) { | 81 if (sortedIndex == fFirstSorted) { |
| 82 ++fFirstSorted; | 82 ++fFirstSorted; |
| 83 } | 83 } |
| 84 continue; | 84 continue; |
| 85 } | 85 } |
| 86 fDone = false; | 86 fDone = false; |
| 87 SkPoint testXY = testSegment->activeLeftTop(NULL); | 87 SkDPoint testXY = testSegment->activeLeftTop(NULL); |
| 88 if (*topStart) { | 88 if (*topStart) { |
| 89 if (testXY.fY < topLeft.fY) { | 89 if (testXY.fY < topLeft.fY) { |
| 90 continue; | 90 continue; |
| 91 } | 91 } |
| 92 if (testXY.fY == topLeft.fY && testXY.fX < topLeft.fX) { | 92 if (testXY.fY == topLeft.fY && testXY.fX < topLeft.fX) { |
| 93 continue; | 93 continue; |
| 94 } | 94 } |
| 95 if (bestXY->fY < testXY.fY) { | 95 if (bestXY->fY < testXY.fY) { |
| 96 continue; | 96 continue; |
| 97 } | 97 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 108 SkOpSegment* segment = &fHead; | 108 SkOpSegment* segment = &fHead; |
| 109 do { | 109 do { |
| 110 if (segment->done()) { | 110 if (segment->done()) { |
| 111 continue; | 111 continue; |
| 112 } | 112 } |
| 113 segment->undoneSpan(startPtr, endPtr); | 113 segment->undoneSpan(startPtr, endPtr); |
| 114 return segment; | 114 return segment; |
| 115 } while ((segment = segment->next())); | 115 } while ((segment = segment->next())); |
| 116 return NULL; | 116 return NULL; |
| 117 } | 117 } |
| OLD | NEW |