remove negate()

negate(x) -> -x

Change-Id: I920b1abe473325309562ca29be6384bedd7e6a42
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280317
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Mike Klein 2020-03-30 08:11:15 -05:00 committed by Skia Commit-Bot
parent 47737a1233
commit d0b568b529
2 changed files with 6 additions and 5 deletions

View File

@ -504,9 +504,7 @@ namespace skvm {
F32 mad(F32 x, F32 y, F32 z) { return add(mul(x,y), z); }
F32 mad(F32a x, F32a y, F32a z) { return mad(_(x), _(y), _(z)); }
F32 negate(F32 x) { return sub(0.0f, x); }
F32 sqrt(F32);
F32 sqrt(F32);
F32 approx_log2(F32);
F32 approx_pow2(F32);
F32 approx_log (F32 x) { return mul(0.69314718f, approx_log2(x)); }
@ -868,6 +866,9 @@ namespace skvm {
static inline F32& operator-=(F32& x, F32a y) { return (x = x - y); }
static inline F32& operator*=(F32& x, F32a y) { return (x = x * y); }
static inline I32 operator-(I32 x) { return 0-x; }
static inline F32 operator-(F32 x) { return 0-x; }
}
#endif//SkVM_DEFINED

View File

@ -268,7 +268,7 @@ skvm::F32 SkTwoPointConicalGradient::transformT(skvm::Builder* p, skvm::Uniforms
skvm::F32 k = p->sqrt(p->sub(p->mul(x,x),
p->mul(y,y)));
if (fFocalData.isSwapped() || 1 - fFocalData.fFocalX < 0) {
k = p->negate(k);
k = -k;
}
t = p->sub(k, p->mul(x, invR1));
}
@ -279,7 +279,7 @@ skvm::F32 SkTwoPointConicalGradient::transformT(skvm::Builder* p, skvm::Uniforms
}
const skvm::F32 focalX = p->uniformF(uniforms->pushF(fFocalData.fFocalX));
if (1 - fFocalData.fFocalX < 0) { t = p->negate(t); }
if (1 - fFocalData.fFocalX < 0) { t = -t; }
if (!fFocalData.isNativelyFocal()) { t = p->add(t, focalX); }
if (fFocalData.isSwapped()) { t = p->sub(p->splat(1.0f), t); }
return t;