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

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

Issue 633393002: harden pathops for pathological test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: exclude new test that asserts in debug Created 6 years, 1 month 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
« no previous file with comments | « src/pathops/SkPathOpsPoint.h ('k') | src/pathops/SkReduceOrder.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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsPoint.h ('k') | src/pathops/SkReduceOrder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698