aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Stephen White <senorblanco@chromium.org>2018-05-25 14:50:56 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-25 20:45:42 +0000
commit06768ca1ea87c027c7a8752fa6495d3e634d1940 (patch)
tree719ca035826aecfe15be29bae6dd66ed07bcd9fb /src
parent6857df77b06c6e5be2409926bf1901349f5466d0 (diff)
GrTessellator: remove collinear vertices.
During sanitize_contours(), remove any points which are collinear with their previous and next points. Bug: skia:8503 Change-Id: Iba1df73b15a92047302bc26f01cb79f4de118760 Reviewed-on: https://skia-review.googlesource.com/130206 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrTessellator.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index 308d5bcc36..4d3c1eb0ee 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -1247,8 +1247,12 @@ void sanitize_contours(VertexList* contours, int contourCnt, bool approximate) {
} else if (!v->fPoint.isFinite()) {
LOG("vertex %g,%g non-finite; removing\n", v->fPoint.fX, v->fPoint.fY);
contour->remove(v);
+ } else if (next && Line(prev->fPoint, next->fPoint).dist(v->fPoint) == 0.0) {
+ LOG("vertex %g,%g collinear; removing\n", v->fPoint.fX, v->fPoint.fY);
+ contour->remove(v);
+ } else {
+ prev = v;
}
- prev = v;
v = next;
}
}