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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 struct SkDRect; | 220 struct SkDRect; |
221 | 221 |
222 inline SkPath::Verb SkPathOpsPointsToVerb(int points) { | 222 inline SkPath::Verb SkPathOpsPointsToVerb(int points) { |
223 int verb = (1 << points) >> 1; | 223 int verb = (1 << points) >> 1; |
224 #ifdef SK_DEBUG | 224 #ifdef SK_DEBUG |
225 switch (points) { | 225 switch (points) { |
226 case 0: SkASSERT(SkPath::kMove_Verb == verb); break; | 226 case 0: SkASSERT(SkPath::kMove_Verb == verb); break; |
227 case 1: SkASSERT(SkPath::kLine_Verb == verb); break; | 227 case 1: SkASSERT(SkPath::kLine_Verb == verb); break; |
228 case 2: SkASSERT(SkPath::kQuad_Verb == verb); break; | 228 case 2: SkASSERT(SkPath::kQuad_Verb == verb); break; |
229 case 3: SkASSERT(SkPath::kCubic_Verb == verb); break; | 229 case 3: SkASSERT(SkPath::kCubic_Verb == verb); break; |
230 default: SkASSERT(!"should not be here"); | 230 default: SkDEBUGFAIL("should not be here"); |
231 } | 231 } |
232 #endif | 232 #endif |
233 return (SkPath::Verb)verb; | 233 return (SkPath::Verb)verb; |
234 } | 234 } |
235 | 235 |
236 inline int SkPathOpsVerbToPoints(SkPath::Verb verb) { | 236 inline int SkPathOpsVerbToPoints(SkPath::Verb verb) { |
237 int points = (int) verb - ((int) verb >> 2); | 237 int points = (int) verb - ((int) verb >> 2); |
238 #ifdef SK_DEBUG | 238 #ifdef SK_DEBUG |
239 switch (verb) { | 239 switch (verb) { |
240 case SkPath::kLine_Verb: SkASSERT(1 == points); break; | 240 case SkPath::kLine_Verb: SkASSERT(1 == points); break; |
241 case SkPath::kQuad_Verb: SkASSERT(2 == points); break; | 241 case SkPath::kQuad_Verb: SkASSERT(2 == points); break; |
242 case SkPath::kCubic_Verb: SkASSERT(3 == points); break; | 242 case SkPath::kCubic_Verb: SkASSERT(3 == points); break; |
243 default: SkASSERT(!"should not get here"); | 243 default: SkDEBUGFAIL("should not get here"); |
244 } | 244 } |
245 #endif | 245 #endif |
246 return points; | 246 return points; |
247 } | 247 } |
248 | 248 |
249 inline double SkDInterp(double A, double B, double t) { | 249 inline double SkDInterp(double A, double B, double t) { |
250 return A + (B - A) * t; | 250 return A + (B - A) * t; |
251 } | 251 } |
252 | 252 |
253 double SkDCubeRoot(double x); | 253 double SkDCubeRoot(double x); |
(...skipping 14 matching lines...) Expand all Loading... |
268 */ | 268 */ |
269 inline int SkDSideBit(double x) { | 269 inline int SkDSideBit(double x) { |
270 return 1 << SKDSide(x); | 270 return 1 << SKDSide(x); |
271 } | 271 } |
272 | 272 |
273 inline double SkPinT(double t) { | 273 inline double SkPinT(double t) { |
274 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
t; | 274 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 :
t; |
275 } | 275 } |
276 | 276 |
277 #endif | 277 #endif |
OLD | NEW |