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

Side by Side Diff: src/pathops/SkPathOpsTypes.cpp

Issue 1313203003: Remove include of stdlib.h from SkTypes.h. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up qsort conversion. Created 5 years, 3 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/SkPathOpsDebug.h ('k') | src/utils/SkEventTracer.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 #include "SkFloatBits.h" 7 #include "SkFloatBits.h"
8 #include "SkOpCoincidence.h" 8 #include "SkOpCoincidence.h"
9 #include "SkPathOpsTypes.h" 9 #include "SkPathOpsTypes.h"
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 SkFloatIntUnion floatIntA, floatIntB; 154 SkFloatIntUnion floatIntA, floatIntB;
155 floatIntA.fFloat = a; 155 floatIntA.fFloat = a;
156 floatIntB.fFloat = b; 156 floatIntB.fFloat = b;
157 // Different signs means they do not match. 157 // Different signs means they do not match.
158 if ((floatIntA.fSignBitInt < 0) != (floatIntB.fSignBitInt < 0)) { 158 if ((floatIntA.fSignBitInt < 0) != (floatIntB.fSignBitInt < 0)) {
159 // Check for equality to make sure +0 == -0 159 // Check for equality to make sure +0 == -0
160 return a == b ? 0 : SK_MaxS32; 160 return a == b ? 0 : SK_MaxS32;
161 } 161 }
162 // Find the difference in ULPs. 162 // Find the difference in ULPs.
163 return abs(floatIntA.fSignBitInt - floatIntB.fSignBitInt); 163 return SkTAbs(floatIntA.fSignBitInt - floatIntB.fSignBitInt);
164 } 164 }
165 165
166 // cube root approximation using bit hack for 64-bit float 166 // cube root approximation using bit hack for 64-bit float
167 // adapted from Kahan's cbrt 167 // adapted from Kahan's cbrt
168 static double cbrt_5d(double d) { 168 static double cbrt_5d(double d) {
169 const unsigned int B1 = 715094163; 169 const unsigned int B1 = 715094163;
170 double t = 0.0; 170 double t = 0.0;
171 unsigned int* pt = (unsigned int*) &t; 171 unsigned int* pt = (unsigned int*) &t;
172 unsigned int* px = (unsigned int*) &d; 172 unsigned int* px = (unsigned int*) &d;
173 pt[1] = px[1] / 3 + B1; 173 pt[1] = px[1] / 3 + B1;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 SkDEBUGPARAMS(fAngleID(0)) 212 SkDEBUGPARAMS(fAngleID(0))
213 SkDEBUGPARAMS(fContourID(0)) 213 SkDEBUGPARAMS(fContourID(0))
214 SkDEBUGPARAMS(fPtTID(0)) 214 SkDEBUGPARAMS(fPtTID(0))
215 SkDEBUGPARAMS(fSegmentID(0)) 215 SkDEBUGPARAMS(fSegmentID(0))
216 SkDEBUGPARAMS(fSpanID(0)) { 216 SkDEBUGPARAMS(fSpanID(0)) {
217 if (coincidence) { 217 if (coincidence) {
218 coincidence->debugSetGlobalState(this); 218 coincidence->debugSetGlobalState(this);
219 } 219 }
220 } 220 }
221 221
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsDebug.h ('k') | src/utils/SkEventTracer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698