| 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 #ifndef SkPathOpsTypes_DEFINED | 7 #ifndef SkPathOpsTypes_DEFINED | 
| 8 #define SkPathOpsTypes_DEFINED | 8 #define SkPathOpsTypes_DEFINED | 
| 9 | 9 | 
| 10 #include <float.h>  // for FLT_EPSILON | 10 #include <float.h>  // for FLT_EPSILON | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 134 } | 134 } | 
| 135 | 135 | 
| 136 inline bool approximately_zero_sqrt(double x) { | 136 inline bool approximately_zero_sqrt(double x) { | 
| 137     return fabs(x) < FLT_EPSILON_SQRT; | 137     return fabs(x) < FLT_EPSILON_SQRT; | 
| 138 } | 138 } | 
| 139 | 139 | 
| 140 inline bool roughly_zero(double x) { | 140 inline bool roughly_zero(double x) { | 
| 141     return fabs(x) < ROUGH_EPSILON; | 141     return fabs(x) < ROUGH_EPSILON; | 
| 142 } | 142 } | 
| 143 | 143 | 
|  | 144 #if 0  // unused for now | 
|  | 145 inline bool way_roughly_zero(double x) { | 
|  | 146     return fabs(x) < WAY_ROUGH_EPSILON; | 
|  | 147 } | 
|  | 148 #endif | 
|  | 149 | 
| 144 inline bool approximately_zero_inverse(double x) { | 150 inline bool approximately_zero_inverse(double x) { | 
| 145     return fabs(x) > FLT_EPSILON_INVERSE; | 151     return fabs(x) > FLT_EPSILON_INVERSE; | 
| 146 } | 152 } | 
| 147 | 153 | 
| 148 // OPTIMIZATION: if called multiple times with the same denom, we want to pass 1
     /y instead | 154 // OPTIMIZATION: if called multiple times with the same denom, we want to pass 1
     /y instead | 
| 149 inline bool approximately_zero_when_compared_to(double x, double y) { | 155 inline bool approximately_zero_when_compared_to(double x, double y) { | 
| 150     return x == 0 || fabs(x) < fabs(y * FLT_EPSILON); | 156     return x == 0 || fabs(x) < fabs(y * FLT_EPSILON); | 
| 151 } | 157 } | 
| 152 | 158 | 
| 153 // Use this for comparing Ts in the range of 0 to 1. For general numbers (larger
      and smaller) use | 159 // Use this for comparing Ts in the range of 0 to 1. For general numbers (larger
      and smaller) use | 
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 371 */ | 377 */ | 
| 372 inline int SkDSideBit(double x) { | 378 inline int SkDSideBit(double x) { | 
| 373     return 1 << SKDSide(x); | 379     return 1 << SKDSide(x); | 
| 374 } | 380 } | 
| 375 | 381 | 
| 376 inline double SkPinT(double t) { | 382 inline double SkPinT(double t) { | 
| 377     return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
      t; | 383     return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
      t; | 
| 378 } | 384 } | 
| 379 | 385 | 
| 380 #endif | 386 #endif | 
| OLD | NEW | 
|---|