aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-25 17:00:47 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-25 17:00:47 +0000
commit0567f222b92d17923c687bed5f54b31652150891 (patch)
treef774ee03f61650fb872e057d9058579844eac0cf /include/core
parent7cf0e9e555290e11d18496a01d85a0ece00b3f43 (diff)
Add SkScalarPow.
git-svn-id: http://skia.googlecode.com/svn/trunk@4754 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkFloatingPoint.h7
-rw-r--r--include/core/SkScalar.h3
2 files changed, 7 insertions, 3 deletions
diff --git a/include/core/SkFloatingPoint.h b/include/core/SkFloatingPoint.h
index 9f354fbfae..b3e490d604 100644
--- a/include/core/SkFloatingPoint.h
+++ b/include/core/SkFloatingPoint.h
@@ -16,10 +16,11 @@
#include <float.h>
#include "SkFloatBits.h"
-// If math.h had powf(float, float), I could remove this wrapper
+// C++98 cmath std::pow seems to be the earliest portable way to get float pow.
+// However, on Linux including cmath undefines isfinite.
+// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14608
static inline float sk_float_pow(float base, float exp) {
- return static_cast<float>(pow(static_cast<double>(base),
- static_cast<double>(exp)));
+ return powf(base, exp);
}
static inline float sk_float_copysign(float x, float y) {
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
index 5be18cb859..ed419689d8 100644
--- a/include/core/SkScalar.h
+++ b/include/core/SkScalar.h
@@ -182,6 +182,9 @@
/** Returns the square root of the SkScalar
*/
#define SkScalarSqrt(x) sk_float_sqrt(x)
+ /** Returns b to the e
+ */
+ #define SkScalarPow(b, e) sk_float_pow(b, e)
/** Returns the average of two SkScalars (a+b)/2
*/
#define SkScalarAve(a, b) (((a) + (b)) * 0.5f)