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

Unified Diff: include/core/SkFloatingPoint.h

Issue 856723003: use log2(scale) to compute mip level (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | include/core/SkScalar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkFloatingPoint.h
diff --git a/include/core/SkFloatingPoint.h b/include/core/SkFloatingPoint.h
index 1003b80b4f1109db3730c54d0b76ede4ae865703..9fb343261b2b1278bbcba14b4f38aba88d9edb92 100644
--- a/include/core/SkFloatingPoint.h
+++ b/include/core/SkFloatingPoint.h
@@ -91,6 +91,16 @@ static inline float sk_float_copysign(float x, float y) {
#define sk_float_log(x) logf(x)
#endif
+// can't find log2f on android, but maybe that just a tool bug?
+#ifdef SK_BUILD_FOR_ANDROID
+ static inline float sk_float_log2(float x) {
+ const double inv_ln_2 = 1.44269504088896;
+ return (float)(log(x) * inv_ln_2);
+ }
+#else
+ #define sk_float_log2(x) log2f(x)
+#endif
+
#ifdef SK_BUILD_FOR_WIN
#define sk_float_isfinite(x) _finite(x)
#define sk_float_isnan(x) _isnan(x)
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | include/core/SkScalar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698