OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "SkFloatBits.h" | 7 #include "SkFloatBits.h" |
| 8 #include "SkOpCoincidence.h" |
8 #include "SkPathOpsTypes.h" | 9 #include "SkPathOpsTypes.h" |
9 | 10 |
10 static bool arguments_denormalized(float a, float b, int epsilon) { | 11 static bool arguments_denormalized(float a, float b, int epsilon) { |
11 float denormalizedCheck = FLT_EPSILON * epsilon / 2; | 12 float denormalizedCheck = FLT_EPSILON * epsilon / 2; |
12 return fabsf(a) <= denormalizedCheck && fabsf(b) <= denormalizedCheck; | 13 return fabsf(a) <= denormalizedCheck && fabsf(b) <= denormalizedCheck; |
13 } | 14 } |
14 | 15 |
15 // from http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-num
bers-2012-edition/ | 16 // from http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-num
bers-2012-edition/ |
16 // FIXME: move to SkFloatBits.h | 17 // FIXME: move to SkFloatBits.h |
17 static bool equal_ulps(float a, float b, int epsilon, int depsilon) { | 18 static bool equal_ulps(float a, float b, int epsilon, int depsilon) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 double SkDCubeRoot(double x) { | 192 double SkDCubeRoot(double x) { |
192 if (approximately_zero_cubed(x)) { | 193 if (approximately_zero_cubed(x)) { |
193 return 0; | 194 return 0; |
194 } | 195 } |
195 double result = halley_cbrt3d(fabs(x)); | 196 double result = halley_cbrt3d(fabs(x)); |
196 if (x < 0) { | 197 if (x < 0) { |
197 result = -result; | 198 result = -result; |
198 } | 199 } |
199 return result; | 200 return result; |
200 } | 201 } |
| 202 |
| 203 SkOpGlobalState::SkOpGlobalState(SkOpCoincidence* coincidence, SkOpContourHead*
head) |
| 204 : fCoincidence(coincidence) |
| 205 , fContourHead(head) |
| 206 , fNested(0) |
| 207 , fWindingFailed(false) |
| 208 , fAngleCoincidence(false) |
| 209 , fPhase(kIntersecting) |
| 210 SkDEBUGPARAMS(fAngleID(0)) |
| 211 SkDEBUGPARAMS(fContourID(0)) |
| 212 SkDEBUGPARAMS(fPtTID(0)) |
| 213 SkDEBUGPARAMS(fSegmentID(0)) |
| 214 SkDEBUGPARAMS(fSpanID(0)) { |
| 215 if (coincidence) { |
| 216 coincidence->debugSetGlobalState(this); |
| 217 } |
| 218 } |
| 219 |
OLD | NEW |