never check for degenerates in path::iter
This does not appear to be used externally, and only internally in 3
sites in GPU, which we can handle explicitly.
For now you can still pass bools to Iter::next() but they are ignored.
After this lands, I will update the callers to remove those.
FWIW: none of our other tests or gms seem to notice this change...
Bug: skia:9339
Change-Id: If40077b1ebb3d47cfce0ec43996ff272318e4a62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235104
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index c3bfd8f..64911cc 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -125,7 +125,7 @@
// Iterate here to consume any degenerate contours and only process the points
// on the actual convex contour.
int n = 0;
- while ((verb = iter.next(pts, true, true)) != SkPath::kDone_Verb) {
+ while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kMove_Verb:
SkASSERT(n == 0);
@@ -135,17 +135,19 @@
if (n >= kMaxEdges) {
return nullptr;
}
- SkVector v = pts[1] - pts[0];
- v.normalize();
- if (SkPathPriv::kCCW_FirstDirection == dir) {
- edges[3 * n] = v.fY;
- edges[3 * n + 1] = -v.fX;
- } else {
- edges[3 * n] = -v.fY;
- edges[3 * n + 1] = v.fX;
+ if (pts[0] != pts[1]) {
+ SkVector v = pts[1] - pts[0];
+ v.normalize();
+ if (SkPathPriv::kCCW_FirstDirection == dir) {
+ edges[3 * n] = v.fY;
+ edges[3 * n + 1] = -v.fX;
+ } else {
+ edges[3 * n] = -v.fY;
+ edges[3 * n + 1] = v.fX;
+ }
+ edges[3 * n + 2] = -(edges[3 * n] * pts[1].fX + edges[3 * n + 1] * pts[1].fY);
+ ++n;
}
- edges[3 * n + 2] = -(edges[3 * n] * pts[1].fX + edges[3 * n + 1] * pts[1].fY);
- ++n;
break;
}
default: