OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 7 |
8 #include "GrAAConvexTessellator.h" | 8 #include "GrAAConvexTessellator.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 } else if (dupPrev && !dupNext) { | 674 } else if (dupPrev && !dupNext) { |
675 dst[cur] = fCandidateVerts.fuseWithPrior(lastRing.origEdgeID(cur)); | 675 dst[cur] = fCandidateVerts.fuseWithPrior(lastRing.origEdgeID(cur)); |
676 } else if (!dupPrev && dupNext) { | 676 } else if (!dupPrev && dupNext) { |
677 dst[cur] = fCandidateVerts.fuseWithNext(); | 677 dst[cur] = fCandidateVerts.fuseWithNext(); |
678 } else { | 678 } else { |
679 bool dupPrevVsNext = duplicate_pt(fCandidateVerts.firstPoint(), fCandida teVerts.lastPoint()); | 679 bool dupPrevVsNext = duplicate_pt(fCandidateVerts.firstPoint(), fCandida teVerts.lastPoint()); |
680 | 680 |
681 if (!dupPrevVsNext) { | 681 if (!dupPrevVsNext) { |
682 dst[cur] = fCandidateVerts.fuseWithPrior(lastRing.origEdgeID(cur)); | 682 dst[cur] = fCandidateVerts.fuseWithPrior(lastRing.origEdgeID(cur)); |
683 } else { | 683 } else { |
684 dst[cur] = dst[cur-1] = fCandidateVerts.fuseWithBoth(); | 684 int fused = fCandidateVerts.fuseWithBoth(); |
685 dst[cur] = fused; | |
robertphillips
2015/07/07 18:50:54
const ?
| |
686 int targetIdx = dst[cur - 1]; | |
robertphillips
2015/07/07 18:50:54
I would personally make this a for loop ...
| |
687 int i = cur - 1; | |
688 while (i >= 0 && dst[i] == targetIdx) { | |
689 dst[i] = fused; | |
690 i--; | |
691 } | |
685 } | 692 } |
686 } | 693 } |
687 | 694 |
688 // Fold the new ring's points into the global pool | 695 // Fold the new ring's points into the global pool |
689 for (int i = 0; i < fCandidateVerts.numPts(); ++i) { | 696 for (int i = 0; i < fCandidateVerts.numPts(); ++i) { |
690 int newIdx; | 697 int newIdx; |
691 if (fCandidateVerts.needsToBeNew(i) || forceNew) { | 698 if (fCandidateVerts.needsToBeNew(i) || forceNew) { |
692 // if the originating index is still valid then this point wasn't | 699 // if the originating index is still valid then this point wasn't |
693 // fused (and is thus movable) | 700 // fused (and is thus movable) |
694 SkScalar coverage = compute_coverage(depth, initialDepth, initialCov erage, | 701 SkScalar coverage = compute_coverage(depth, initialDepth, initialCov erage, |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 SkString num; | 1015 SkString num; |
1009 num.printf("%d", i); | 1016 num.printf("%d", i); |
1010 canvas->drawText(num.c_str(), num.size(), | 1017 canvas->drawText(num.c_str(), num.size(), |
1011 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f ), | 1018 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f ), |
1012 paint); | 1019 paint); |
1013 } | 1020 } |
1014 } | 1021 } |
1015 | 1022 |
1016 #endif | 1023 #endif |
1017 | 1024 |
OLD | NEW |