Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 7156db2

Browse files
csmartdalton86Skia Commit-Bot
authored andcommitted
Revert "Update GrTriangulator to use SkPathPriv::Iterate"
This reverts commit 64964bb. Reason for revert: Iter does not behave the same as RawIter Original change's description: > Update GrTriangulator to use SkPathPriv::Iterate > > Change-Id: I0998f22e3ce958fd651c359c930a2e48af27ce73 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285985 > Commit-Queue: Chris Dalton <csmartdalton@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,csmartdalton@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I3387f95a966d18d2262c1a6b534c61c46e4a8b4c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288662 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
1 parent 2f2d81c commit 7156db2

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

src/gpu/GrTriangulator.cpp

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,10 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
822822
SkScalar toleranceSqd = tolerance * tolerance;
823823
bool innerPolygons = (Mode::kSimpleInnerPolygons == mode);
824824

825+
SkPoint pts[4];
825826
int localCurveCount = 0;
826827
VertexList* contour = contours;
828+
SkPath::Iter iter(path, false);
827829
if (path.isInverseFillType()) {
828830
SkPoint quad[4];
829831
clipBounds.toQuad(quad);
@@ -833,32 +835,34 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
833835
contour++;
834836
}
835837
SkAutoConicToQuads converter;
836-
for (auto [verb, pts, w] : SkPathPriv::Iterate(path)) {
838+
SkPath::Verb verb;
839+
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
837840
switch (verb) {
838-
case SkPathVerb::kConic: {
841+
case SkPath::kConic_Verb: {
839842
++localCurveCount;
840843
if (innerPolygons) {
841844
append_point_to_contour(pts[2], contour, alloc);
842845
break;
843846
}
844-
const SkPoint* quadPts = converter.computeQuads(pts, *w, toleranceSqd);
847+
SkScalar weight = iter.conicWeight();
848+
const SkPoint* quadPts = converter.computeQuads(pts, weight, toleranceSqd);
845849
for (int i = 0; i < converter.countQuads(); ++i) {
846850
append_quadratic_to_contour(quadPts, toleranceSqd, contour, alloc);
847851
quadPts += 2;
848852
}
849853
break;
850854
}
851-
case SkPathVerb::kMove:
855+
case SkPath::kMove_Verb:
852856
if (contour->fHead) {
853857
contour++;
854858
}
855859
append_point_to_contour(pts[0], contour, alloc);
856860
break;
857-
case SkPathVerb::kLine: {
861+
case SkPath::kLine_Verb: {
858862
append_point_to_contour(pts[1], contour, alloc);
859863
break;
860864
}
861-
case SkPathVerb::kQuad: {
865+
case SkPath::kQuad_Verb: {
862866
++localCurveCount;
863867
if (innerPolygons) {
864868
append_point_to_contour(pts[2], contour, alloc);
@@ -867,7 +871,7 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
867871
append_quadratic_to_contour(pts, toleranceSqd, contour, alloc);
868872
break;
869873
}
870-
case SkPathVerb::kCubic: {
874+
case SkPath::kCubic_Verb: {
871875
++localCurveCount;
872876
if (innerPolygons) {
873877
append_point_to_contour(pts[3], contour, alloc);
@@ -878,7 +882,8 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
878882
pointsLeft, alloc);
879883
break;
880884
}
881-
case SkPathVerb::kClose:
885+
case SkPath::kClose_Verb:
886+
case SkPath::kDone_Verb:
882887
break;
883888
}
884889
}
@@ -2385,18 +2390,21 @@ int get_contour_count(const SkPath& path, SkScalar tolerance) {
23852390
int contourCnt = 1;
23862391
bool hasPoints = false;
23872392

2393+
SkPath::Iter iter(path, false);
2394+
SkPath::Verb verb;
2395+
SkPoint pts[4];
23882396
bool first = true;
2389-
for (auto [verb, pts, w] : SkPathPriv::Iterate(path)) {
2397+
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
23902398
switch (verb) {
2391-
case SkPathVerb::kMove:
2399+
case SkPath::kMove_Verb:
23922400
if (!first) {
23932401
++contourCnt;
23942402
}
23952403
// fallthru.
2396-
case SkPathVerb::kLine:
2397-
case SkPathVerb::kConic:
2398-
case SkPathVerb::kQuad:
2399-
case SkPathVerb::kCubic:
2404+
case SkPath::kLine_Verb:
2405+
case SkPath::kConic_Verb:
2406+
case SkPath::kQuad_Verb:
2407+
case SkPath::kCubic_Verb:
24002408
hasPoints = true;
24012409
// fallthru to break.
24022410
default:

0 commit comments

Comments
 (0)