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

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

Issue 849333002: use log2(scale) to compute mip level (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « include/core/SkFloatingPoint.h ('k') | src/core/SkMipMap.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 7
8 #ifndef SkScalar_DEFINED 8 #ifndef SkScalar_DEFINED
9 #define SkScalar_DEFINED 9 #define SkScalar_DEFINED
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #define SkScalarPow(b, e) sk_float_pow(b, e) 51 #define SkScalarPow(b, e) sk_float_pow(b, e)
52 52
53 #define SkScalarSin(radians) (float)sk_float_sin(radians) 53 #define SkScalarSin(radians) (float)sk_float_sin(radians)
54 #define SkScalarCos(radians) (float)sk_float_cos(radians) 54 #define SkScalarCos(radians) (float)sk_float_cos(radians)
55 #define SkScalarTan(radians) (float)sk_float_tan(radians) 55 #define SkScalarTan(radians) (float)sk_float_tan(radians)
56 #define SkScalarASin(val) (float)sk_float_asin(val) 56 #define SkScalarASin(val) (float)sk_float_asin(val)
57 #define SkScalarACos(val) (float)sk_float_acos(val) 57 #define SkScalarACos(val) (float)sk_float_acos(val)
58 #define SkScalarATan2(y, x) (float)sk_float_atan2(y,x) 58 #define SkScalarATan2(y, x) (float)sk_float_atan2(y,x)
59 #define SkScalarExp(x) (float)sk_float_exp(x) 59 #define SkScalarExp(x) (float)sk_float_exp(x)
60 #define SkScalarLog(x) (float)sk_float_log(x) 60 #define SkScalarLog(x) (float)sk_float_log(x)
61 #define SkScalarLog2(x) (float)sk_float_log2(x)
61 62
62 #else // SK_SCALAR_IS_DOUBLE 63 #else // SK_SCALAR_IS_DOUBLE
63 64
64 typedef double SkScalar; 65 typedef double SkScalar;
65 66
66 #define SK_Scalar1 1.0 67 #define SK_Scalar1 1.0
67 #define SK_ScalarHalf 0.5 68 #define SK_ScalarHalf 0.5
68 #define SK_ScalarSqrt2 1.414213562373095 69 #define SK_ScalarSqrt2 1.414213562373095
69 #define SK_ScalarPI 3.141592653589793 70 #define SK_ScalarPI 3.141592653589793
70 #define SK_ScalarTanPIOver8 0.4142135623731 71 #define SK_ScalarTanPIOver8 0.4142135623731
(...skipping 22 matching lines...) Expand all
93 #define SkScalarPow(b, e) pow(b, e) 94 #define SkScalarPow(b, e) pow(b, e)
94 95
95 #define SkScalarSin(radians) sin(radians) 96 #define SkScalarSin(radians) sin(radians)
96 #define SkScalarCos(radians) cos(radians) 97 #define SkScalarCos(radians) cos(radians)
97 #define SkScalarTan(radians) tan(radians) 98 #define SkScalarTan(radians) tan(radians)
98 #define SkScalarASin(val) asin(val) 99 #define SkScalarASin(val) asin(val)
99 #define SkScalarACos(val) acos(val) 100 #define SkScalarACos(val) acos(val)
100 #define SkScalarATan2(y, x) atan2(y,x) 101 #define SkScalarATan2(y, x) atan2(y,x)
101 #define SkScalarExp(x) exp(x) 102 #define SkScalarExp(x) exp(x)
102 #define SkScalarLog(x) log(x) 103 #define SkScalarLog(x) log(x)
104 #define SkScalarLog2(x) log2(x)
103 105
104 #endif 106 #endif
105 107
106 //////////////////////////////////////////////////////////////////////////////// ////////////////// 108 //////////////////////////////////////////////////////////////////////////////// //////////////////
107 109
108 #define SkIntToScalar(x) static_cast<SkScalar>(x) 110 #define SkIntToScalar(x) static_cast<SkScalar>(x)
109 #define SkScalarTruncToInt(x) static_cast<int>(x) 111 #define SkScalarTruncToInt(x) static_cast<int>(x)
110 112
111 #define SkScalarToFloat(x) static_cast<float>(x) 113 #define SkScalarToFloat(x) static_cast<float>(x)
112 #define SkFloatToScalar(x) static_cast<SkScalar>(x) 114 #define SkFloatToScalar(x) static_cast<SkScalar>(x)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 SkASSERT(n >= 0); 243 SkASSERT(n >= 0);
242 for (int i = 0; i < n; ++i) { 244 for (int i = 0; i < n; ++i) {
243 if (a[i] != b[i]) { 245 if (a[i] != b[i]) {
244 return false; 246 return false;
245 } 247 }
246 } 248 }
247 return true; 249 return true;
248 } 250 }
249 251
250 #endif 252 #endif
OLDNEW
« no previous file with comments | « include/core/SkFloatingPoint.h ('k') | src/core/SkMipMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698