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

Side by Side Diff: include/core/SkFloatingPoint.h

Issue 1173673003: A bunch of little SkMScalar-as-float build fixes. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 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 | « bench/Matrix44Bench.cpp ('k') | src/utils/SkMatrix44.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkFloatingPoint_DEFINED 10 #ifndef SkFloatingPoint_DEFINED
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #define sk_float_acos(x) acosf(x) 84 #define sk_float_acos(x) acosf(x)
85 #define sk_float_asin(x) asinf(x) 85 #define sk_float_asin(x) asinf(x)
86 #endif 86 #endif
87 #define sk_float_atan2(y,x) atan2f(y,x) 87 #define sk_float_atan2(y,x) atan2f(y,x)
88 #define sk_float_abs(x) fabsf(x) 88 #define sk_float_abs(x) fabsf(x)
89 #define sk_float_mod(x,y) fmodf(x,y) 89 #define sk_float_mod(x,y) fmodf(x,y)
90 #define sk_float_exp(x) expf(x) 90 #define sk_float_exp(x) expf(x)
91 #define sk_float_log(x) logf(x) 91 #define sk_float_log(x) logf(x)
92 #endif 92 #endif
93 93
94 #define sk_float_round(x) sk_float_floor((x) + 0.5f)
95
94 // can't find log2f on android, but maybe that just a tool bug? 96 // can't find log2f on android, but maybe that just a tool bug?
95 #ifdef SK_BUILD_FOR_ANDROID 97 #ifdef SK_BUILD_FOR_ANDROID
96 static inline float sk_float_log2(float x) { 98 static inline float sk_float_log2(float x) {
97 const double inv_ln_2 = 1.44269504088896; 99 const double inv_ln_2 = 1.44269504088896;
98 return (float)(log(x) * inv_ln_2); 100 return (float)(log(x) * inv_ln_2);
99 } 101 }
100 #else 102 #else
101 #define sk_float_log2(x) log2f(x) 103 #define sk_float_log2(x) log2f(x)
102 #endif 104 #endif
103 105
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 float estimate = *SkTCast<float*>(&i); 177 float estimate = *SkTCast<float*>(&i);
176 178
177 // One step of Newton's method to refine. 179 // One step of Newton's method to refine.
178 const float estimate_sq = estimate*estimate; 180 const float estimate_sq = estimate*estimate;
179 estimate *= (1.5f-0.5f*x*estimate_sq); 181 estimate *= (1.5f-0.5f*x*estimate_sq);
180 return estimate; 182 return estimate;
181 #endif 183 #endif
182 } 184 }
183 185
184 #endif 186 #endif
OLDNEW
« no previous file with comments | « bench/Matrix44Bench.cpp ('k') | src/utils/SkMatrix44.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698