| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 | 7 |
| 8 #ifndef SkPoint_DEFINED | 8 #ifndef SkPoint_DEFINED |
| 9 #define SkPoint_DEFINED | 9 #define SkPoint_DEFINED |
| 10 | 10 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 return a.fX == b.fX && a.fY == b.fY; | 346 return a.fX == b.fX && a.fY == b.fY; |
| 347 } | 347 } |
| 348 | 348 |
| 349 friend bool operator!=(const SkPoint& a, const SkPoint& b) { | 349 friend bool operator!=(const SkPoint& a, const SkPoint& b) { |
| 350 return a.fX != b.fX || a.fY != b.fY; | 350 return a.fX != b.fX || a.fY != b.fY; |
| 351 } | 351 } |
| 352 | 352 |
| 353 /** Return true if this point and the given point are far enough apart | 353 /** Return true if this point and the given point are far enough apart |
| 354 such that a vector between them would be non-degenerate. | 354 such that a vector between them would be non-degenerate. |
| 355 | 355 |
| 356 WARNING: Unlike the deprecated version of equalsWithinTolerance(), | 356 WARNING: Unlike the explicit tolerance version, |
| 357 this method does not use componentwise comparison. Instead, it | 357 this method does not use componentwise comparison. Instead, it |
| 358 uses a comparison designed to match judgments elsewhere regarding | 358 uses a comparison designed to match judgments elsewhere regarding |
| 359 degeneracy ("points A and B are so close that the vector between them | 359 degeneracy ("points A and B are so close that the vector between them |
| 360 is essentially zero"). | 360 is essentially zero"). |
| 361 */ | 361 */ |
| 362 bool equalsWithinTolerance(const SkPoint& p) const { | 362 bool equalsWithinTolerance(const SkPoint& p) const { |
| 363 return !CanNormalize(fX - p.fX, fY - p.fY); | 363 return !CanNormalize(fX - p.fX, fY - p.fY); |
| 364 } | 364 } |
| 365 | 365 |
| 366 /** DEPRECATED: Return true if this and the given point are componentwise | 366 /** WARNING: There is no guarantee that the result will reflect judgments |
| 367 within tolerance "tol". | |
| 368 | |
| 369 WARNING: There is no guarantee that the result will reflect judgments | |
| 370 elsewhere regarding degeneracy ("points A and B are so close that the | 367 elsewhere regarding degeneracy ("points A and B are so close that the |
| 371 vector between them is essentially zero"). | 368 vector between them is essentially zero"). |
| 372 */ | 369 */ |
| 373 bool equalsWithinTolerance(const SkPoint& p, SkScalar tol) const { | 370 bool equalsWithinTolerance(const SkPoint& p, SkScalar tol) const { |
| 374 return SkScalarNearlyZero(fX - p.fX, tol) | 371 return SkScalarNearlyZero(fX - p.fX, tol) |
| 375 && SkScalarNearlyZero(fY - p.fY, tol); | 372 && SkScalarNearlyZero(fY - p.fY, tol); |
| 376 } | 373 } |
| 377 | 374 |
| 378 /** Returns a new point whose coordinates are the difference between | 375 /** Returns a new point whose coordinates are the difference between |
| 379 a's and b's (a - b) | 376 a's and b's (a - b) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 504 |
| 508 /** | 505 /** |
| 509 * cast-safe way to treat the point as an array of (2) SkScalars. | 506 * cast-safe way to treat the point as an array of (2) SkScalars. |
| 510 */ | 507 */ |
| 511 const SkScalar* asScalars() const { return &fX; } | 508 const SkScalar* asScalars() const { return &fX; } |
| 512 }; | 509 }; |
| 513 | 510 |
| 514 typedef SkPoint SkVector; | 511 typedef SkPoint SkVector; |
| 515 | 512 |
| 516 #endif | 513 #endif |
| OLD | NEW |