| OLD | NEW | 
|     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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   736     R = (2*a*a*a - 9*a*b + 27*c) / 54; |   736     R = (2*a*a*a - 9*a*b + 27*c) / 54; | 
|   737  |   737  | 
|   738     SkScalar Q3 = Q * Q * Q; |   738     SkScalar Q3 = Q * Q * Q; | 
|   739     SkScalar R2MinusQ3 = R * R - Q3; |   739     SkScalar R2MinusQ3 = R * R - Q3; | 
|   740     SkScalar adiv3 = a / 3; |   740     SkScalar adiv3 = a / 3; | 
|   741  |   741  | 
|   742     SkScalar*   roots = tValues; |   742     SkScalar*   roots = tValues; | 
|   743     SkScalar    r; |   743     SkScalar    r; | 
|   744  |   744  | 
|   745     if (R2MinusQ3 < 0) { // we have 3 real roots |   745     if (R2MinusQ3 < 0) { // we have 3 real roots | 
|   746         SkScalar theta = SkScalarACos(R / SkScalarSqrt(Q3)); |   746         // the divide/root can, due to finite precisions, be slightly outside of
       -1...1 | 
 |   747         SkScalar theta = SkScalarACos(SkScalarPin(R / SkScalarSqrt(Q3), -1, 1)); | 
|   747         SkScalar neg2RootQ = -2 * SkScalarSqrt(Q); |   748         SkScalar neg2RootQ = -2 * SkScalarSqrt(Q); | 
|   748  |   749  | 
|   749         r = neg2RootQ * SkScalarCos(theta/3) - adiv3; |   750         r = neg2RootQ * SkScalarCos(theta/3) - adiv3; | 
|   750         if (is_unit_interval(r)) { |   751         if (is_unit_interval(r)) { | 
|   751             *roots++ = r; |   752             *roots++ = r; | 
|   752         } |   753         } | 
|   753         r = neg2RootQ * SkScalarCos((theta + 2*SK_ScalarPI)/3) - adiv3; |   754         r = neg2RootQ * SkScalarCos((theta + 2*SK_ScalarPI)/3) - adiv3; | 
|   754         if (is_unit_interval(r)) { |   755         if (is_unit_interval(r)) { | 
|   755             *roots++ = r; |   756             *roots++ = r; | 
|   756         } |   757         } | 
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1338         matrix.preScale(SK_Scalar1, -SK_Scalar1); |  1339         matrix.preScale(SK_Scalar1, -SK_Scalar1); | 
|  1339     } |  1340     } | 
|  1340     if (userMatrix) { |  1341     if (userMatrix) { | 
|  1341         matrix.postConcat(*userMatrix); |  1342         matrix.postConcat(*userMatrix); | 
|  1342     } |  1343     } | 
|  1343     for (int i = 0; i < conicCount; ++i) { |  1344     for (int i = 0; i < conicCount; ++i) { | 
|  1344         matrix.mapPoints(dst[i].fPts, 3); |  1345         matrix.mapPoints(dst[i].fPts, 3); | 
|  1345     } |  1346     } | 
|  1346     return conicCount; |  1347     return conicCount; | 
|  1347 } |  1348 } | 
| OLD | NEW |