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 const int fused = fCandidateVerts.fuseWithBoth(); |
| 685 dst[cur] = fused; |
| 686 const int targetIdx = dst[cur - 1]; |
| 687 for (int i = cur - 1; i >= 0 && dst[i] == targetIdx; i--) { |
| 688 dst[i] = fused; |
| 689 } |
685 } | 690 } |
686 } | 691 } |
687 | 692 |
688 // Fold the new ring's points into the global pool | 693 // Fold the new ring's points into the global pool |
689 for (int i = 0; i < fCandidateVerts.numPts(); ++i) { | 694 for (int i = 0; i < fCandidateVerts.numPts(); ++i) { |
690 int newIdx; | 695 int newIdx; |
691 if (fCandidateVerts.needsToBeNew(i) || forceNew) { | 696 if (fCandidateVerts.needsToBeNew(i) || forceNew) { |
692 // if the originating index is still valid then this point wasn't | 697 // if the originating index is still valid then this point wasn't |
693 // fused (and is thus movable) | 698 // fused (and is thus movable) |
694 SkScalar coverage = compute_coverage(depth, initialDepth, initialCov
erage, | 699 SkScalar coverage = compute_coverage(depth, initialDepth, initialCov
erage, |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 SkString num; | 1013 SkString num; |
1009 num.printf("%d", i); | 1014 num.printf("%d", i); |
1010 canvas->drawText(num.c_str(), num.size(), | 1015 canvas->drawText(num.c_str(), num.size(), |
1011 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f
), | 1016 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f
), |
1012 paint); | 1017 paint); |
1013 } | 1018 } |
1014 } | 1019 } |
1015 | 1020 |
1016 #endif | 1021 #endif |
1017 | 1022 |
OLD | NEW |