aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2016-01-08 14:09:18 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-08 14:09:18 -0800
commit1bcbc8f8c0747691496d779055675bc47ca65c86 (patch)
tree1def629c0b1fe7804c154b4add0cfdf5cddc3187 /src/gpu/batches
parentb10fe4941b08172378d3d1928959122f106ced37 (diff)
Fixed an assertion error in GrAAConvexTessellator. While adding a new point, it would check that the new point was not a duplicate of the previous point. It would then drop the previous point if it was in the middle of a straight line, and proceed to add the new point.
Unfortunately, floating point precision issues mean that sometimes, after dropping the previous point, we'd end up with the newly-added point as a duplicate of the new previous point, tripping an assertion failure. BUG=skia:4732 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1557903002 Review URL: https://codereview.chromium.org/1557903002
Diffstat (limited to 'src/gpu/batches')
-rw-r--r--src/gpu/batches/GrAAConvexTessellator.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gpu/batches/GrAAConvexTessellator.cpp b/src/gpu/batches/GrAAConvexTessellator.cpp
index 5ef9aefddd..c3d25948de 100644
--- a/src/gpu/batches/GrAAConvexTessellator.cpp
+++ b/src/gpu/batches/GrAAConvexTessellator.cpp
@@ -835,6 +835,13 @@ void GrAAConvexTessellator::lineTo(SkPoint p, bool isCurve) {
this->popLastPt();
fNorms.pop();
fIsCurve.pop();
+ // double-check that the new last point is not a duplicate of the new point. In an ideal
+ // world this wouldn't be necessary (since it's only possible for non-convex paths), but
+ // floating point precision issues mean it can actually happen on paths that were determined
+ // to be convex.
+ if (duplicate_pt(p, this->lastPoint())) {
+ return;
+ }
}
SkScalar initialRingCoverage = fStrokeWidth < 0.0f ? 0.5f : 1.0f;
this->addPt(p, 0.0f, initialRingCoverage, false, isCurve);