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

Unified Diff: src/core/SkGeometry.cpp

Issue 2142393003: handle large conic weights (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another double warning Created 4 years, 5 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 | « include/core/SkPoint.h ('k') | tests/GeometryTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGeometry.cpp
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 5d181a3a20ae045598765a7b64be4c7340408781..7dd5359b7dea112e9c2280a39d902a5335b12489 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1170,9 +1170,18 @@ static SkPoint* subdivide(const SkConic& src, SkPoint pts[], int level) {
int SkConic::chopIntoQuadsPOW2(SkPoint pts[], int pow2) const {
SkASSERT(pow2 >= 0);
+ const int quadCount = 1 << pow2;
+ const int ptCount = 2 * quadCount + 1;
*pts = fPts[0];
SkDEBUGCODE(SkPoint* endPts =) subdivide(*this, pts + 1, pow2);
- SkASSERT(endPts - pts == (2 * (1 << pow2) + 1));
+ SkASSERT(endPts - pts == ptCount);
+ if (!SkPointsAreFinite(pts, ptCount)) {
+ // if we generated a non-finite, pin ourselves to the middle of the hull,
+ // as our first and last are already on the first/last pts of the hull.
+ for (int i = 1; i < ptCount - 1; ++i) {
+ pts[i] = fPts[1];
+ }
+ }
return 1 << pow2;
}
« no previous file with comments | « include/core/SkPoint.h ('k') | tests/GeometryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698