Remove overly-promiscuous SkNx syntax sugar.

I haven't figured out a pithy way to have these apply to only classes
originating from SkNx, so let's just remove them.  There aren't too
many use cases, and it's not really any less readable without them.

Semantically, this is a no-op.

BUG=skia:

Review URL: https://codereview.chromium.org/1167153002
This commit is contained in:
mtklein 2015-06-10 08:57:28 -07:00 committed by Commit bot
parent 55812362f1
commit f2fe0e0320
7 changed files with 14 additions and 25 deletions

View File

@ -121,10 +121,10 @@ struct PMFloatGradientBench : public Benchmark {
fDevice[i+1] = SkPMFloat(b).trunc();
fDevice[i+2] = SkPMFloat(c).trunc();
fDevice[i+3] = SkPMFloat(d).trunc();
a += dcdx4;
b += dcdx4;
c += dcdx4;
d += dcdx4;
a = a + dcdx4;
b = b + dcdx4;
c = c + dcdx4;
d = d + dcdx4;
}
}
}

View File

@ -1284,7 +1284,7 @@ SkPoint SkConic::evalAt(SkScalar t) const {
Sk2s numer = quad_poly_eval(A, B, C, tt);
B = times_2(ww - one);
A = -B;
A = Sk2s(0)-B;
Sk2s denom = quad_poly_eval(A, B, one, tt);
return to_point(numer / denom);

View File

@ -260,17 +260,6 @@ protected:
} // namespace
// Generic syntax sugar that should work equally well for all implementations.
template <typename T> T operator - (const T& l) { return T(0) - l; }
template <typename L, typename R> L& operator += (L& l, const R& r) { return (l = l + r); }
template <typename L, typename R> L& operator -= (L& l, const R& r) { return (l = l - r); }
template <typename L, typename R> L& operator *= (L& l, const R& r) { return (l = l * r); }
template <typename L, typename R> L& operator /= (L& l, const R& r) { return (l = l / r); }
template <typename L> L& operator <<= (L& l, int bits) { return (l = l << bits); }
template <typename L> L& operator >>= (L& l, int bits) { return (l = l >> bits); }
// Include platform specific specializations if available.
#ifndef SKNX_NO_SIMD
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2

View File

@ -72,12 +72,12 @@ bool SkRect::setBoundsCheck(const SkPoint pts[], int count) {
count -= 2;
}
accum = max = min;
accum *= Sk4s(0);
accum = accum * Sk4s(0);
count >>= 1;
for (int i = 0; i < count; ++i) {
Sk4s xy = Sk4s::Load(&pts->fX);
accum *= xy;
accum = accum * xy;
min = Sk4s::Min(min, xy);
max = Sk4s::Max(max, xy);
pts += 2;

View File

@ -233,7 +233,7 @@ static void hairquad(const SkPoint pts[3], const SkRegion* clip,
Sk2s B = Sk2s::Load(&coeff[1].fX);
Sk2s C = Sk2s::Load(&coeff[2].fX);
for (int i = 1; i < lines; ++i) {
t += dt;
t = t + dt;
((A * t + B) * t + C).store(&tmp[i].fX);
}
tmp[lines] = pts[2];
@ -241,7 +241,7 @@ static void hairquad(const SkPoint pts[3], const SkRegion* clip,
}
static inline Sk2s abs(const Sk2s& value) {
return Sk2s::Max(value, -value);
return Sk2s::Max(value, Sk2s(0)-value);
}
static inline SkScalar max_component(const Sk2s& value) {
@ -298,7 +298,7 @@ static void hair_cubic(const SkPoint pts[4], const SkRegion* clip, SkBlitter* bl
SkPoint coeff[4];
SkCubicToCoeff(pts, coeff);
const Sk2s dt(SK_Scalar1 / lines);
Sk2s t(0);
@ -311,7 +311,7 @@ static void hair_cubic(const SkPoint pts[4], const SkRegion* clip, SkBlitter* bl
Sk2s C = Sk2s::Load(&coeff[2].fX);
Sk2s D = Sk2s::Load(&coeff[3].fX);
for (int i = 1; i < lines; ++i) {
t += dt;
t = t + dt;
(((A * t + B) * t + C) * t + D).store(&tmp[i].fX);
}
tmp[lines] = pts[3];

View File

@ -320,8 +320,8 @@ void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
for (int i = 0; i < (count >> 2); ++i) {
Sk4f dist = Sk4f::Min(fast_sqrt(R), max);
R += dR;
dR += ddR;
R = R + dR;
dR = dR + ddR;
int fi[4];
dist.castTrunc().store(fi);

View File

@ -46,7 +46,7 @@ static void test_Nf(skiatest::Reporter* r) {
assert_eq(a*b-b, 6, 12, 20, 30);
assert_eq((a*b).sqrt(), 3, 4, 5, 6);
assert_eq(a/b, 1, 1, 1, 1);
assert_eq(-a, -3, -4, -5, -6);
assert_eq(SkNf<N,T>(0)-a, -3, -4, -5, -6);
SkNf<N,T> fours(4);