diff options
author | mtklein <mtklein@chromium.org> | 2015-06-10 08:57:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-10 08:57:28 -0700 |
commit | f2fe0e03205c4d7f70496ec8c6bea9a82ae88329 (patch) | |
tree | 9b7eeff3cef8650aa31bd54f436c25494803e0e9 | |
parent | 55812362f1df3c1f7341f687d5bab0adab8ac954 (diff) |
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
-rw-r--r-- | bench/PMFloatBench.cpp | 8 | ||||
-rw-r--r-- | src/core/SkGeometry.cpp | 2 | ||||
-rw-r--r-- | src/core/SkNx.h | 11 | ||||
-rw-r--r-- | src/core/SkRect.cpp | 4 | ||||
-rw-r--r-- | src/core/SkScan_Hairline.cpp | 8 | ||||
-rw-r--r-- | src/effects/gradients/SkRadialGradient.cpp | 4 | ||||
-rw-r--r-- | tests/SkNxTest.cpp | 2 |
7 files changed, 14 insertions, 25 deletions
diff --git a/bench/PMFloatBench.cpp b/bench/PMFloatBench.cpp index 14ccb33d0a..37542e3525 100644 --- a/bench/PMFloatBench.cpp +++ b/bench/PMFloatBench.cpp @@ -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; } } } diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp index 2cda344a5d..6afd9d7ffb 100644 --- a/src/core/SkGeometry.cpp +++ b/src/core/SkGeometry.cpp @@ -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); diff --git a/src/core/SkNx.h b/src/core/SkNx.h index 0f5aa829df..d968cad19f 100644 --- a/src/core/SkNx.h +++ b/src/core/SkNx.h @@ -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 diff --git a/src/core/SkRect.cpp b/src/core/SkRect.cpp index a28af27cb1..6c44ea2544 100644 --- a/src/core/SkRect.cpp +++ b/src/core/SkRect.cpp @@ -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; diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp index 4ed5ec254c..eeac5cdc2f 100644 --- a/src/core/SkScan_Hairline.cpp +++ b/src/core/SkScan_Hairline.cpp @@ -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]; diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index fec180cfa1..b6b31c592f 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -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); diff --git a/tests/SkNxTest.cpp b/tests/SkNxTest.cpp index f8801500db..2463b46f08 100644 --- a/tests/SkNxTest.cpp +++ b/tests/SkNxTest.cpp @@ -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); |