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

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

Issue 272153002: fix bugs found by computing flat clips in 800K skps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix maybe-uninitialized error in unbuntu Created 6 years, 6 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
« no previous file with comments | « src/pathops/SkPathOpsOp.cpp ('k') | src/pathops/SkPathOpsSimplify.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 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 SkDPoint dA, dB; 141 SkDPoint dA, dB;
142 dA.set(a); 142 dA.set(a);
143 dB.set(b); 143 dB.set(b);
144 double dist = dA.distance(dB); // OPTIMIZATION: can we compare against distSq instead ? 144 double dist = dA.distance(dB); // OPTIMIZATION: can we compare against distSq instead ?
145 float tiniest = SkTMin(SkTMin(SkTMin(a.fX, b.fX), a.fY), b.fY); 145 float tiniest = SkTMin(SkTMin(SkTMin(a.fX, b.fX), a.fY), b.fY);
146 float largest = SkTMax(SkTMax(SkTMax(a.fX, b.fX), a.fY), b.fY); 146 float largest = SkTMax(SkTMax(SkTMax(a.fX, b.fX), a.fY), b.fY);
147 largest = SkTMax(largest, -tiniest); 147 largest = SkTMax(largest, -tiniest);
148 return AlmostBequalUlps((double) largest, largest + dist); // is dist wi thin ULPS tolerance? 148 return AlmostBequalUlps((double) largest, largest + dist); // is dist wi thin ULPS tolerance?
149 } 149 }
150 150
151 #ifdef SK_DEBUG
152 static bool RoughlyEqual(const SkPoint& a, const SkPoint& b) { 151 static bool RoughlyEqual(const SkPoint& a, const SkPoint& b) {
153 if (approximately_equal(a.fX, b.fX) && approximately_equal(a.fY, b.fY)) { 152 if (approximately_equal(a.fX, b.fX) && approximately_equal(a.fY, b.fY)) {
154 return true; 153 return true;
155 } 154 }
156 return RoughlyEqualUlps(a.fX, b.fX) && RoughlyEqualUlps(a.fY, b.fY); 155 return RoughlyEqualUlps(a.fX, b.fX) && RoughlyEqualUlps(a.fY, b.fY);
157 } 156 }
158 #endif
159 157
160 bool approximatelyPEqual(const SkDPoint& a) const { 158 bool approximatelyPEqual(const SkDPoint& a) const {
161 if (approximately_equal(fX, a.fX) && approximately_equal(fY, a.fY)) { 159 if (approximately_equal(fX, a.fX) && approximately_equal(fY, a.fY)) {
162 return true; 160 return true;
163 } 161 }
164 if (!RoughlyEqualUlps(fX, a.fX) || !RoughlyEqualUlps(fY, a.fY)) { 162 if (!RoughlyEqualUlps(fX, a.fX) || !RoughlyEqualUlps(fY, a.fY)) {
165 return false; 163 return false;
166 } 164 }
167 double dist = distance(a); // OPTIMIZATION: can we compare against dist Sq instead ? 165 double dist = distance(a); // OPTIMIZATION: can we compare against dist Sq instead ?
168 double tiniest = SkTMin(SkTMin(SkTMin(fX, a.fX), fY), a.fY); 166 double tiniest = SkTMin(SkTMin(SkTMin(fX, a.fX), fY), a.fY);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool roughlyEqual(const SkDPoint& a) const { 223 bool roughlyEqual(const SkDPoint& a) const {
226 return roughly_equal(a.fY, fY) && roughly_equal(a.fX, fX); 224 return roughly_equal(a.fY, fY) && roughly_equal(a.fX, fX);
227 } 225 }
228 226
229 // utilities callable by the user from the debugger when the implementation code is linked in 227 // utilities callable by the user from the debugger when the implementation code is linked in
230 void dump() const; 228 void dump() const;
231 static void Dump(const SkPoint& pt); 229 static void Dump(const SkPoint& pt);
232 }; 230 };
233 231
234 #endif 232 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsOp.cpp ('k') | src/pathops/SkPathOpsSimplify.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698