| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 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 "SkMath.h" | 8 #include "SkMath.h" |
| 9 #include "SkPoint.h" | 9 #include "SkPoint.h" |
| 10 #include "SkScalar.h" | 10 #include "SkScalar.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (shift > MAX_COEFF_SHIFT) { | 53 if (shift > MAX_COEFF_SHIFT) { |
| 54 shift = MAX_COEFF_SHIFT; | 54 shift = MAX_COEFF_SHIFT; |
| 55 } | 55 } |
| 56 return 1 << shift; | 56 return 1 << shift; |
| 57 } | 57 } |
| 58 | 58 |
| 59 static inline uint32_t compute_pointCount(SkScalar d, SkScalar tol) { | 59 static inline uint32_t compute_pointCount(SkScalar d, SkScalar tol) { |
| 60 if (d < tol) { | 60 if (d < tol) { |
| 61 return 1; | 61 return 1; |
| 62 } else { | 62 } else { |
| 63 int temp = SkScalarCeilToInt(SkScalarSqrt(d / tol)); | 63 int temp = SkScalarCeilToInt(SkScalarSqrt(SkScalarDiv(d, tol))); |
| 64 uint32_t count = SkMin32(SkNextPow2(temp), MAX_POINTS_PER_CURVE); | 64 uint32_t count = SkMin32(SkNextPow2(temp), MAX_POINTS_PER_CURVE); |
| 65 return count; | 65 return count; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 static uint32_t quadraticPointCount_EE(const SkPoint points[]) { | 69 static uint32_t quadraticPointCount_EE(const SkPoint points[]) { |
| 70 int distance = estimate_distance(points); | 70 int distance = estimate_distance(points); |
| 71 return estimate_pointCount(distance); | 71 return estimate_pointCount(distance); |
| 72 } | 72 } |
| 73 | 73 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 one_d_pe(gSawtooth, SK_ARRAY_COUNT(gSawtooth), reporter); | 154 one_d_pe(gSawtooth, SK_ARRAY_COUNT(gSawtooth), reporter); |
| 155 one_d_pe(gOvalish, SK_ARRAY_COUNT(gOvalish), reporter); | 155 one_d_pe(gOvalish, SK_ARRAY_COUNT(gOvalish), reporter); |
| 156 one_d_pe(gSharpSawtooth, SK_ARRAY_COUNT(gSharpSawtooth), reporter); | 156 one_d_pe(gSharpSawtooth, SK_ARRAY_COUNT(gSharpSawtooth), reporter); |
| 157 one_d_pe(gRibbon, SK_ARRAY_COUNT(gRibbon), reporter); | 157 one_d_pe(gRibbon, SK_ARRAY_COUNT(gRibbon), reporter); |
| 158 } | 158 } |
| 159 | 159 |
| 160 DEF_TEST(PathCoverage, reporter) { | 160 DEF_TEST(PathCoverage, reporter) { |
| 161 TestQuadPointCount(reporter); | 161 TestQuadPointCount(reporter); |
| 162 | 162 |
| 163 } | 163 } |
| OLD | NEW |