aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleAAGeometry.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-09-26 11:03:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-26 11:03:54 -0700
commit414c4295f951d43068666b6294df15b2fd2ba85c (patch)
tree4a8abbb094d1cedc8eb1b2a773f6b2f3609f0576 /samplecode/SampleAAGeometry.cpp
parent849f5027e9d3e27c34453966fc3471eb57e76e54 (diff)
allow conic chop to fail
Fuzzy values may cause the conic chop to fail. Check to see if the values are all finite, and require the caller to do the same. R=reed@google.com BUG=650178 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2368993002 Review-Url: https://codereview.chromium.org/2368993002
Diffstat (limited to 'samplecode/SampleAAGeometry.cpp')
-rw-r--r--samplecode/SampleAAGeometry.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/samplecode/SampleAAGeometry.cpp b/samplecode/SampleAAGeometry.cpp
index 7d873032e4..4b7a37420b 100644
--- a/samplecode/SampleAAGeometry.cpp
+++ b/samplecode/SampleAAGeometry.cpp
@@ -220,7 +220,9 @@ static void add_path_segment(int index, SkPath* path) {
SkConic chop[2];
SkConic conic;
conic.set(pts, iter.conicWeight());
- conic.chopAt(0.5f, chop);
+ if (!conic.chopAt(0.5f, chop)) {
+ return;
+ }
result.conicTo(chop[0].fPts[1], chop[0].fPts[2], chop[0].fW);
pts[1] = chop[1].fPts[1];
weight = chop[1].fW;
@@ -1360,9 +1362,10 @@ public:
SkConic split[2];
SkConic conic;
conic.set(pts, weight);
- conic.chopAt(0.5f, split);
- conic_coverage(split[0].fPts, split[0].fW, distanceMap, w, h);
- conic_coverage(split[1].fPts, split[1].fW, distanceMap, w, h);
+ if (conic.chopAt(0.5f, split)) {
+ conic_coverage(split[0].fPts, split[0].fW, distanceMap, w, h);
+ conic_coverage(split[1].fPts, split[1].fW, distanceMap, w, h);
+ }
}
void cubic_coverage(SkPoint pts[4], uint8_t* distanceMap, int w, int h) {