aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGeometry.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-09-06 08:54:10 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-06 08:54:10 -0700
commite97fe839728aa77a413353395b5a4c94c4c1d931 (patch)
treedd233ca9aa536e423b1f4b39444c4c75ae76bfdd /src/core/SkGeometry.cpp
parentb2be02bb39351ed97e789f7d3e97c7180f72560f (diff)
compare degenerates with tolerance
Conics with very large w values can be approximated with two straight lines. This avoids iterating endlessly in an attempt to create quadratics with unstable numerics. Check to see if the first chop generated a pair of lines within the default point comparison tolerance. R=reed@google.com BUG=643933, 643665 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2312923002 Review-Url: https://codereview.chromium.org/2312923002
Diffstat (limited to 'src/core/SkGeometry.cpp')
-rw-r--r--src/core/SkGeometry.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 8f270f9722..a3ebfb38a8 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1176,7 +1176,8 @@ int SkConic::chopIntoQuadsPOW2(SkPoint pts[], int pow2) const {
SkConic dst[2];
this->chop(dst);
// check to see if the first chop generates a pair of lines
- if (dst[0].fPts[1] == dst[0].fPts[2] && dst[1].fPts[0] == dst[1].fPts[1]) {
+ if (dst[0].fPts[1].equalsWithinTolerance(dst[0].fPts[2])
+ && dst[1].fPts[0].equalsWithinTolerance(dst[1].fPts[1])) {
pts[1] = pts[2] = pts[3] = dst[0].fPts[1]; // set ctrl == end to make lines
pts[4] = dst[1].fPts[2];
pow2 = 1;