| 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 SkPathOpsPoint_DEFINED | 7 #ifndef SkPathOpsPoint_DEFINED |
| 8 #define SkPathOpsPoint_DEFINED | 8 #define SkPathOpsPoint_DEFINED |
| 9 | 9 |
| 10 #include "SkPathOpsTypes.h" | 10 #include "SkPathOpsTypes.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 fX += v.fX; | 108 fX += v.fX; |
| 109 fY += v.fY; | 109 fY += v.fY; |
| 110 } | 110 } |
| 111 | 111 |
| 112 // only used by testing | 112 // only used by testing |
| 113 void operator-=(const SkDVector& v) { | 113 void operator-=(const SkDVector& v) { |
| 114 fX -= v.fX; | 114 fX -= v.fX; |
| 115 fY -= v.fY; | 115 fY -= v.fY; |
| 116 } | 116 } |
| 117 | 117 |
| 118 // only used by testing |
| 119 SkDPoint operator+(const SkDVector& v) { |
| 120 SkDPoint result = *this; |
| 121 result += v; |
| 122 return result; |
| 123 } |
| 124 |
| 125 // only used by testing |
| 126 SkDPoint operator-(const SkDVector& v) { |
| 127 SkDPoint result = *this; |
| 128 result -= v; |
| 129 return result; |
| 130 } |
| 131 |
| 118 // note: this can not be implemented with | 132 // note: this can not be implemented with |
| 119 // return approximately_equal(a.fY, fY) && approximately_equal(a.fX, fX); | 133 // return approximately_equal(a.fY, fY) && approximately_equal(a.fX, fX); |
| 120 // because that will not take the magnitude of the values into account | 134 // because that will not take the magnitude of the values into account |
| 121 bool approximatelyEqual(const SkDPoint& a) const { | 135 bool approximatelyEqual(const SkDPoint& a) const { |
| 122 if (approximately_equal(fX, a.fX) && approximately_equal(fY, a.fY)) { | 136 if (approximately_equal(fX, a.fX) && approximately_equal(fY, a.fY)) { |
| 123 return true; | 137 return true; |
| 124 } | 138 } |
| 125 if (!RoughlyEqualUlps(fX, a.fX) || !RoughlyEqualUlps(fY, a.fY)) { | 139 if (!RoughlyEqualUlps(fX, a.fX) || !RoughlyEqualUlps(fY, a.fY)) { |
| 126 return false; | 140 return false; |
| 127 } | 141 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return RoughlyEqualUlps((double) largest, largest + dist); // is dist wi
thin ULPS tolerance? | 221 return RoughlyEqualUlps((double) largest, largest + dist); // is dist wi
thin ULPS tolerance? |
| 208 } | 222 } |
| 209 | 223 |
| 210 // utilities callable by the user from the debugger when the implementation
code is linked in | 224 // utilities callable by the user from the debugger when the implementation
code is linked in |
| 211 void dump() const; | 225 void dump() const; |
| 212 static void Dump(const SkPoint& pt); | 226 static void Dump(const SkPoint& pt); |
| 213 static void DumpHex(const SkPoint& pt); | 227 static void DumpHex(const SkPoint& pt); |
| 214 }; | 228 }; |
| 215 | 229 |
| 216 #endif | 230 #endif |
| OLD | NEW |