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

Side by Side Diff: src/core/SkGeometry.cpp

Issue 1580463002: Cherry pick to M48: give up on quad root if infinite (Closed) Base URL: https://skia.googlesource.com/skia.git@m48
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGeometry.h" 8 #include "SkGeometry.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 #include "SkNx.h" 10 #include "SkNx.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]) { 83 int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]) {
84 SkASSERT(roots); 84 SkASSERT(roots);
85 85
86 if (A == 0) { 86 if (A == 0) {
87 return valid_unit_divide(-C, B, roots); 87 return valid_unit_divide(-C, B, roots);
88 } 88 }
89 89
90 SkScalar* r = roots; 90 SkScalar* r = roots;
91 91
92 SkScalar R = B*B - 4*A*C; 92 SkScalar R = B*B - 4*A*C;
93 if (R < 0 || SkScalarIsNaN(R)) { // complex roots 93 if (R < 0 || !SkScalarIsFinite(R)) { // complex roots
94 return 0; 94 return 0;
95 } 95 }
96 R = SkScalarSqrt(R); 96 R = SkScalarSqrt(R);
97 97
98 SkScalar Q = (B < 0) ? -(B-R)/2 : -(B+R)/2; 98 SkScalar Q = (B < 0) ? -(B-R)/2 : -(B+R)/2;
99 r += valid_unit_divide(Q, A, r); 99 r += valid_unit_divide(Q, A, r);
100 r += valid_unit_divide(C, Q, r); 100 r += valid_unit_divide(C, Q, r);
101 if (r - roots == 2) { 101 if (r - roots == 2) {
102 if (roots[0] > roots[1]) 102 if (roots[0] > roots[1])
103 SkTSwap<SkScalar>(roots[0], roots[1]); 103 SkTSwap<SkScalar>(roots[0], roots[1]);
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 matrix.preScale(SK_Scalar1, -SK_Scalar1); 1590 matrix.preScale(SK_Scalar1, -SK_Scalar1);
1591 } 1591 }
1592 if (userMatrix) { 1592 if (userMatrix) {
1593 matrix.postConcat(*userMatrix); 1593 matrix.postConcat(*userMatrix);
1594 } 1594 }
1595 for (int i = 0; i < conicCount; ++i) { 1595 for (int i = 0; i < conicCount; ++i) {
1596 matrix.mapPoints(dst[i].fPts, 3); 1596 matrix.mapPoints(dst[i].fPts, 3);
1597 } 1597 }
1598 return conicCount; 1598 return conicCount;
1599 } 1599 }
OLDNEW
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698