зеркало из https://github.com/mozilla/moz-skia.git
Add SkScalarPow.
git-svn-id: http://skia.googlecode.com/svn/trunk@4754 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
7cf0e9e555
Коммит
0567f222b9
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -23,9 +23,6 @@ class GrGLSpecularLightingEffect;
|
|||
typedef GrGLShaderBuilder::UniformHandle UniformHandle;
|
||||
static const UniformHandle kInvalidUniformHandle = GrGLShaderBuilder::kInvalidUniformHandle;
|
||||
|
||||
// FIXME: Eventually, this should be implemented properly, and put in
|
||||
// SkScalar.h.
|
||||
#define SkScalarPow(x, y) SkFloatToScalar(powf(SkScalarToFloat(x), SkScalarToFloat(y)))
|
||||
namespace {
|
||||
|
||||
const SkScalar gOneThird = SkScalarInvert(SkIntToScalar(3));
|
||||
|
|
Загрузка…
Ссылка в новой задаче