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

Side by Side Diff: src/pathops/SkPathOpsTypes.h

Issue 19183003: path ops near exact (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove unused static function Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkPathOpsSimplify.cpp ('k') | src/pathops/SkPathOpsTypes.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 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 15 matching lines...) Expand all
26 bool AlmostEqualUlps(float A, float B); 26 bool AlmostEqualUlps(float A, float B);
27 inline bool AlmostEqualUlps(double A, double B) { 27 inline bool AlmostEqualUlps(double A, double B) {
28 return AlmostEqualUlps(SkDoubleToScalar(A), SkDoubleToScalar(B)); 28 return AlmostEqualUlps(SkDoubleToScalar(A), SkDoubleToScalar(B));
29 } 29 }
30 30
31 bool RoughlyEqualUlps(float A, float B); 31 bool RoughlyEqualUlps(float A, float B);
32 inline bool RoughlyEqualUlps(double A, double B) { 32 inline bool RoughlyEqualUlps(double A, double B) {
33 return RoughlyEqualUlps(SkDoubleToScalar(A), SkDoubleToScalar(B)); 33 return RoughlyEqualUlps(SkDoubleToScalar(A), SkDoubleToScalar(B));
34 } 34 }
35 35
36 bool AlmostBetweenUlps(float a, float b, float c);
37 inline bool AlmostBetweenUlps(double A, double B, double C) {
38 return AlmostBetweenUlps(SkDoubleToScalar(A), SkDoubleToScalar(B), SkDoubleT oScalar(C));
39 }
40
36 // FLT_EPSILON == 1.19209290E-07 == 1 / (2 ^ 23) 41 // FLT_EPSILON == 1.19209290E-07 == 1 / (2 ^ 23)
37 // DBL_EPSILON == 2.22045e-16 42 // DBL_EPSILON == 2.22045e-16
38 const double FLT_EPSILON_CUBED = FLT_EPSILON * FLT_EPSILON * FLT_EPSILON; 43 const double FLT_EPSILON_CUBED = FLT_EPSILON * FLT_EPSILON * FLT_EPSILON;
39 const double FLT_EPSILON_HALF = FLT_EPSILON / 2; 44 const double FLT_EPSILON_HALF = FLT_EPSILON / 2;
40 const double FLT_EPSILON_DOUBLE = FLT_EPSILON * 2; 45 const double FLT_EPSILON_DOUBLE = FLT_EPSILON * 2;
41 const double FLT_EPSILON_SQUARED = FLT_EPSILON * FLT_EPSILON; 46 const double FLT_EPSILON_SQUARED = FLT_EPSILON * FLT_EPSILON;
42 const double FLT_EPSILON_SQRT = sqrt(FLT_EPSILON); 47 const double FLT_EPSILON_SQRT = sqrt(FLT_EPSILON);
43 const double FLT_EPSILON_INVERSE = 1 / FLT_EPSILON; 48 const double FLT_EPSILON_INVERSE = 1 / FLT_EPSILON;
44 const double DBL_EPSILON_ERR = DBL_EPSILON * 4; // FIXME: tune -- allow a few b its of error 49 const double DBL_EPSILON_ERR = DBL_EPSILON * 4; // FIXME: tune -- allow a few b its of error
45 const double DBL_EPSILON_SUBDIVIDE_ERR = DBL_EPSILON * 16; 50 const double DBL_EPSILON_SUBDIVIDE_ERR = DBL_EPSILON * 16;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 inline int SKDSide(double x) { 258 inline int SKDSide(double x) {
254 return (x > 0) + (x >= 0); 259 return (x > 0) + (x >= 0);
255 } 260 }
256 261
257 /* Returns 1 if negative, 2 if zero, 4 if positive 262 /* Returns 1 if negative, 2 if zero, 4 if positive
258 */ 263 */
259 inline int SkDSideBit(double x) { 264 inline int SkDSideBit(double x) {
260 return 1 << SKDSide(x); 265 return 1 << SKDSide(x);
261 } 266 }
262 267
268 inline double SkPinT(double t) {
269 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 : t;
270 }
271
263 #endif 272 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsSimplify.cpp ('k') | src/pathops/SkPathOpsTypes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698