Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Unified Diff: samplecode/SampleAAGeometry.cpp

Issue 2368993002: allow conic chop to fail (Closed)
Patch Set: address comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/beziereffects.cpp ('k') | src/core/SkGeometry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleAAGeometry.cpp
diff --git a/samplecode/SampleAAGeometry.cpp b/samplecode/SampleAAGeometry.cpp
index 7d873032e49dc53bdec8c8f73a22bb8c8408b717..4b7a37420bcd3b595bd72876cd5c000997cc34f5 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) {
« no previous file with comments | « gm/beziereffects.cpp ('k') | src/core/SkGeometry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698