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 #include "SkUtils.h" | 8 #include "SkUtils.h" |
9 | 9 |
10 static_assert(sizeof(Sk4px) == 16, "This file uses memcpy / sk_memset32, so exac
t size matters."); | 10 static_assert(sizeof(Sk4px) == 16, "This file uses memcpy / sk_memset32, so exac
t size matters."); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return this->widenLo() * Sk4px(other).widenLo(); | 48 return this->widenLo() * Sk4px(other).widenLo(); |
49 } | 49 } |
50 | 50 |
51 inline Sk4px Sk4px::Wide::addNarrowHi(const Sk16h& other) const { | 51 inline Sk4px Sk4px::Wide::addNarrowHi(const Sk16h& other) const { |
52 Sk4px::Wide r = (*this + other) >> 8; | 52 Sk4px::Wide r = (*this + other) >> 8; |
53 return Sk16b(r.kth< 0>(), r.kth< 1>(), r.kth< 2>(), r.kth< 3>(), | 53 return Sk16b(r.kth< 0>(), r.kth< 1>(), r.kth< 2>(), r.kth< 3>(), |
54 r.kth< 4>(), r.kth< 5>(), r.kth< 6>(), r.kth< 7>(), | 54 r.kth< 4>(), r.kth< 5>(), r.kth< 6>(), r.kth< 7>(), |
55 r.kth< 8>(), r.kth< 9>(), r.kth<10>(), r.kth<11>(), | 55 r.kth< 8>(), r.kth< 9>(), r.kth<10>(), r.kth<11>(), |
56 r.kth<12>(), r.kth<13>(), r.kth<14>(), r.kth<15>()); | 56 r.kth<12>(), r.kth<13>(), r.kth<14>(), r.kth<15>()); |
57 } | 57 } |
| 58 |
| 59 inline Sk4px Sk4px::alphas() const { |
| 60 static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); |
| 61 return Sk16b(this->kth< 3>(), this->kth< 3>(), this->kth< 3>(), this->kth< 3
>(), |
| 62 this->kth< 7>(), this->kth< 7>(), this->kth< 7>(), this->kth< 7
>(), |
| 63 this->kth<11>(), this->kth<11>(), this->kth<11>(), this->kth<11
>(), |
| 64 this->kth<15>(), this->kth<15>(), this->kth<15>(), this->kth<15
>()); |
| 65 } |
| 66 |
| 67 inline Sk4px Sk4px::Load4Alphas(const SkAlpha a[4]) { |
| 68 return Sk16b(a[0], a[0], a[0], a[0], |
| 69 a[1], a[1], a[1], a[1], |
| 70 a[2], a[2], a[2], a[2], |
| 71 a[3], a[3], a[3], a[3]); |
| 72 } |
| 73 |
| 74 inline Sk4px Sk4px::Load2Alphas(const SkAlpha a[2]) { |
| 75 return Sk16b(a[0], a[0], a[0], a[0], |
| 76 a[1], a[1], a[1], a[1], |
| 77 0,0,0,0, |
| 78 0,0,0,0); |
| 79 } |
OLD | NEW |