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

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

Issue 13934009: path ops -- use standard max, min, double-is-nan (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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/SkPathOpsQuad.cpp ('k') | tests/PathOpsDRectTest.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
11 #include <math.h> // for fabs, sqrt 11 #include <math.h> // for fabs, sqrt
12 12
13 #include "SkFloatingPoint.h" 13 #include "SkFloatingPoint.h"
14 #include "SkPathOps.h" 14 #include "SkPathOps.h"
15 #include "SkPathOpsDebug.h" 15 #include "SkPathOpsDebug.h"
16 #include "SkScalar.h" 16 #include "SkScalar.h"
17 17
18 // FIXME: move these into SkTypes.h
19 template <typename T> inline T SkTMax(T a, T b) {
20 if (a < b)
21 a = b;
22 return a;
23 }
24
25 template <typename T> inline T SkTMin(T a, T b) {
26 if (a > b)
27 a = b;
28 return a;
29 }
30
31 // FIXME: move this into SkFloatingPoint.h
32 #define sk_double_isnan(a) sk_float_isnan(a)
33
34 enum SkPathOpsMask { 18 enum SkPathOpsMask {
35 kWinding_PathOpsMask = -1, 19 kWinding_PathOpsMask = -1,
36 kNo_PathOpsMask = 0, 20 kNo_PathOpsMask = 0,
37 kEvenOdd_PathOpsMask = 1 21 kEvenOdd_PathOpsMask = 1
38 }; 22 };
39 23
40 extern bool AlmostEqualUlps(float A, float B); 24 extern bool AlmostEqualUlps(float A, float B);
41 inline bool AlmostEqualUlps(double A, double B) { 25 inline bool AlmostEqualUlps(double A, double B) {
42 return AlmostEqualUlps(SkDoubleToScalar(A), SkDoubleToScalar(B)); 26 return AlmostEqualUlps(SkDoubleToScalar(A), SkDoubleToScalar(B));
43 } 27 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return (x > 0) + (x >= 0); 206 return (x > 0) + (x >= 0);
223 } 207 }
224 208
225 /* Returns 1 if negative, 2 if zero, 4 if positive 209 /* Returns 1 if negative, 2 if zero, 4 if positive
226 */ 210 */
227 inline int SkDSideBit(double x) { 211 inline int SkDSideBit(double x) {
228 return 1 << SKDSide(x); 212 return 1 << SKDSide(x);
229 } 213 }
230 214
231 #endif 215 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsQuad.cpp ('k') | tests/PathOpsDRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698