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

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

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix linux build Created 5 years, 8 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
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (roughly_equal(fX, a.fX) && roughly_equal(fY, a.fY)) { 186 if (roughly_equal(fX, a.fX) && roughly_equal(fY, a.fY)) {
187 return true; 187 return true;
188 } 188 }
189 double dist = distance(a); // OPTIMIZATION: can we compare against dist Sq instead ? 189 double dist = distance(a); // OPTIMIZATION: can we compare against dist Sq instead ?
190 double tiniest = SkTMin(SkTMin(SkTMin(fX, a.fX), fY), a.fY); 190 double tiniest = SkTMin(SkTMin(SkTMin(fX, a.fX), fY), a.fY);
191 double largest = SkTMax(SkTMax(SkTMax(fX, a.fX), fY), a.fY); 191 double largest = SkTMax(SkTMax(SkTMax(fX, a.fX), fY), a.fY);
192 largest = SkTMax(largest, -tiniest); 192 largest = SkTMax(largest, -tiniest);
193 return RoughlyEqualUlps(largest, largest + dist); // is the dist within ULPS tolerance? 193 return RoughlyEqualUlps(largest, largest + dist); // is the dist within ULPS tolerance?
194 } 194 }
195 195
196 static bool RoughlyEqual(const SkPoint& a, const SkPoint& b) {
197 if (!RoughlyEqualUlps(a.fX, b.fX) || !RoughlyEqualUlps(a.fY, b.fY)) {
198 return false;
199 }
200 SkDPoint dA, dB;
201 dA.set(a);
202 dB.set(b);
203 double dist = dA.distance(dB); // OPTIMIZATION: can we compare against distSq instead ?
204 float tiniest = SkTMin(SkTMin(SkTMin(a.fX, b.fX), a.fY), b.fY);
205 float largest = SkTMax(SkTMax(SkTMax(a.fX, b.fX), a.fY), b.fY);
206 largest = SkTMax(largest, -tiniest);
207 return RoughlyEqualUlps((double) largest, largest + dist); // is dist wi thin ULPS tolerance?
208 }
209
196 // utilities callable by the user from the debugger when the implementation code is linked in 210 // utilities callable by the user from the debugger when the implementation code is linked in
197 void dump() const; 211 void dump() const;
198 static void Dump(const SkPoint& pt); 212 static void Dump(const SkPoint& pt);
199 static void DumpHex(const SkPoint& pt); 213 static void DumpHex(const SkPoint& pt);
200 }; 214 };
201 215
202 #endif 216 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698