diff options
author | mtklein <mtklein@chromium.org> | 2015-03-30 10:50:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-30 10:50:27 -0700 |
commit | c9adb05b64fa0bfadf9d1a782afcda470da68c9e (patch) | |
tree | 6413cc149b70ae36181e9f0789246b9db24447f0 /bench | |
parent | 23ac62c83a49d675a38f1c20462b5537f3c8af01 (diff) |
Refactor Sk2x<T> + Sk4x<T> into SkNf<N,T> and SkNi<N,T>
The primary feature this delivers is SkNf and SkNd for arbitrary power-of-two N. Non-specialized types or types larger than 128 bits should now Just Work (and we can drop in a specialization to make them faster). Sk4s is now just a typedef for SkNf<4, SkScalar>; Sk4d is SkNf<4, double>, Sk2f SkNf<2, float>, etc.
This also makes implementing new specializations easier and more encapsulated. We're now using template specialization, which means the specialized versions don't have to leak out so much from SkNx_sse.h and SkNx_neon.h.
This design leaves us room to grow up, e.g to SkNf<8, SkScalar> == Sk8s, and to grown down too, to things like SkNi<8, uint16_t> == Sk8h.
To simplify things, I've stripped away most APIs (swizzles, casts, reinterpret_casts) that no one's using yet. I will happily add them back if they seem useful.
You shouldn't feel bad about using any of the typedef Sk4s, Sk4f, Sk4d, Sk2s, Sk2f, Sk2d, Sk4i, etc. Here's how you should feel:
- Sk4f, Sk4s, Sk2d: feel awesome
- Sk2f, Sk2s, Sk4d: feel pretty good
No public API changes.
TBR=reed@google.com
BUG=skia:3592
Review URL: https://codereview.chromium.org/1048593002
Diffstat (limited to 'bench')
-rw-r--r-- | bench/PMFloatBench.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bench/PMFloatBench.cpp b/bench/PMFloatBench.cpp index 09819e9962..fd0d232d2a 100644 --- a/bench/PMFloatBench.cpp +++ b/bench/PMFloatBench.cpp @@ -103,7 +103,7 @@ struct PMFloatGradientBench : public Benchmark { SkPMColor fDevice[100]; void onDraw(const int loops, SkCanvas*) override { - Sk4f c0 = SkPMFloat::FromARGB(255, 255, 0, 0), + Sk4s c0 = SkPMFloat::FromARGB(255, 255, 0, 0), c1 = SkPMFloat::FromARGB(255, 0, 0, 255), dc = c1 - c0, fx(0.1f), @@ -112,7 +112,7 @@ struct PMFloatGradientBench : public Benchmark { dcdx4(dcdx+dcdx+dcdx+dcdx); for (int n = 0; n < loops; n++) { - Sk4f a = c0 + dc*fx + Sk4f(0.5f), // The +0.5f lets us call trunc() instead of get(). + Sk4s a = c0 + dc*fx + Sk4s(0.5f), // The +0.5f lets us call trunc() instead of get(). b = a + dcdx, c = b + dcdx, d = c + dcdx; |