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

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

Issue 18058007: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: try try again Created 7 years, 5 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/SkPathOpsOp.cpp ('k') | src/pathops/SkPathOpsTypes.h » ('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 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 SkTMax(fabs(a.fX), fabs(a.fY)))); 104 SkTMax(fabs(a.fX), fabs(a.fY))));
105 if (denom == 0) { 105 if (denom == 0) {
106 return true; 106 return true;
107 } 107 }
108 double inv = 1 / denom; 108 double inv = 1 / denom;
109 return approximately_equal(fX * inv, a.fX * inv) 109 return approximately_equal(fX * inv, a.fX * inv)
110 && approximately_equal(fY * inv, a.fY * inv); 110 && approximately_equal(fY * inv, a.fY * inv);
111 } 111 }
112 112
113 bool approximatelyEqual(const SkPoint& a) const { 113 bool approximatelyEqual(const SkPoint& a) const {
114 double denom = SkTMax(fabs(fX), SkTMax(fabs(fY), 114 return AlmostEqualUlps(SkDoubleToScalar(fX), a.fX)
115 SkScalarToDouble(SkTMax(fabsf(a.fX), fabsf(a.fY))))); 115 && AlmostEqualUlps(SkDoubleToScalar(fY), a.fY);
116 if (denom == 0) {
117 return true;
118 }
119 double inv = 1 / denom;
120 return approximately_equal_double(fX * inv, a.fX * inv)
121 && approximately_equal_double(fY * inv, a.fY * inv);
122 } 116 }
123 117
124 bool approximatelyEqualHalf(const SkDPoint& a) const { 118 bool approximatelyEqualHalf(const SkDPoint& a) const {
125 double denom = SkTMax(fabs(fX), SkTMax(fabs(fY), 119 double denom = SkTMax(fabs(fX), SkTMax(fabs(fY),
126 SkTMax(fabs(a.fX), fabs(a.fY)))); 120 SkTMax(fabs(a.fX), fabs(a.fY))));
127 if (denom == 0) { 121 if (denom == 0) {
128 return true; 122 return true;
129 } 123 }
130 double inv = 1 / denom; 124 double inv = 1 / denom;
131 return approximately_equal_half(fX * inv, a.fX * inv) 125 return approximately_equal_half(fX * inv, a.fX * inv)
(...skipping 29 matching lines...) Expand all
161 double moreRoughlyEqual(const SkDPoint& a) const { 155 double moreRoughlyEqual(const SkDPoint& a) const {
162 return more_roughly_equal(a.fY, fY) && more_roughly_equal(a.fX, fX); 156 return more_roughly_equal(a.fY, fY) && more_roughly_equal(a.fX, fX);
163 } 157 }
164 158
165 double roughlyEqual(const SkDPoint& a) const { 159 double roughlyEqual(const SkDPoint& a) const {
166 return roughly_equal(a.fY, fY) && roughly_equal(a.fX, fX); 160 return roughly_equal(a.fY, fY) && roughly_equal(a.fX, fX);
167 } 161 }
168 }; 162 };
169 163
170 #endif 164 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsOp.cpp ('k') | src/pathops/SkPathOpsTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698