Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkNx_DEFINED | 8 #ifndef SkNx_DEFINED |
| 9 #define SkNx_DEFINED | 9 #define SkNx_DEFINED |
| 10 | 10 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 #include "../opts/SkNx_neon.h" | 302 #include "../opts/SkNx_neon.h" |
| 303 #else | 303 #else |
| 304 | 304 |
| 305 SI Sk4i Sk4f_round(const Sk4f& x) { | 305 SI Sk4i Sk4f_round(const Sk4f& x) { |
| 306 return { (int) lrintf (x[0]), | 306 return { (int) lrintf (x[0]), |
| 307 (int) lrintf (x[1]), | 307 (int) lrintf (x[1]), |
| 308 (int) lrintf (x[2]), | 308 (int) lrintf (x[2]), |
| 309 (int) lrintf (x[3]), }; | 309 (int) lrintf (x[3]), }; |
| 310 } | 310 } |
| 311 | 311 |
| 312 // Transpose 4 Sk4h and store (256 bits total). | |
| 313 SI void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk4h& b, cons t Sk4h& a) { | |
|
mtklein
2016/07/19 15:37:47
How about
auto dst64 = (uint64_t*)dst;
Sk4h(r[0],
msarett
2016/07/19 15:47:20
SGTM
| |
| 314 Sk4h rgba0 = Sk4h(r[0], g[0], b[0], a[0]); | |
| 315 Sk4h rgba1 = Sk4h(r[1], g[1], b[1], a[1]); | |
| 316 Sk4h rgba2 = Sk4h(r[2], g[2], b[2], a[2]); | |
| 317 Sk4h rgba3 = Sk4h(r[3], g[3], b[3], a[3]); | |
| 318 | |
| 319 uint64_t* dst64 = (uint64_t*) dst; | |
| 320 rgba0.store(dst64 + 0); | |
| 321 rgba1.store(dst64 + 1); | |
| 322 rgba2.store(dst64 + 2); | |
| 323 rgba3.store(dst64 + 3); | |
| 324 } | |
| 325 | |
| 312 #endif | 326 #endif |
| 313 | 327 |
| 314 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c, const Sk4f& d) { | 328 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c, const Sk4f& d) { |
| 315 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); | 329 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); |
| 316 } | 330 } |
| 317 | 331 |
| 318 #undef SI | 332 #undef SI |
| 319 | 333 |
| 320 #endif//SkNx_DEFINED | 334 #endif//SkNx_DEFINED |
| OLD | NEW |