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 namespace { // See Sk4px.h | 10 namespace { // See Sk4px.h |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 inline Sk4px::Wide Sk4px::widenLo() const { | 42 inline Sk4px::Wide Sk4px::widenLo() const { |
43 return Sk16h(this->kth< 0>(), this->kth< 1>(), this->kth< 2>(), this->kth< 3
>(), | 43 return Sk16h(this->kth< 0>(), this->kth< 1>(), this->kth< 2>(), this->kth< 3
>(), |
44 this->kth< 4>(), this->kth< 5>(), this->kth< 6>(), this->kth< 7
>(), | 44 this->kth< 4>(), this->kth< 5>(), this->kth< 6>(), this->kth< 7
>(), |
45 this->kth< 8>(), this->kth< 9>(), this->kth<10>(), this->kth<11
>(), | 45 this->kth< 8>(), this->kth< 9>(), this->kth<10>(), this->kth<11
>(), |
46 this->kth<12>(), this->kth<13>(), this->kth<14>(), this->kth<15
>()); | 46 this->kth<12>(), this->kth<13>(), this->kth<14>(), this->kth<15
>()); |
47 } | 47 } |
48 | 48 |
49 inline Sk4px::Wide Sk4px::widenHi() const { return this->widenLo() << 8; } | 49 inline Sk4px::Wide Sk4px::widenHi() const { return this->widenLo() << 8; } |
50 | 50 |
| 51 inline Sk4px::Wide Sk4px::widenLoHi() const { return this->widenLo() + this->wid
enHi(); } |
| 52 |
51 inline Sk4px::Wide Sk4px::mulWiden(const Sk16b& other) const { | 53 inline Sk4px::Wide Sk4px::mulWiden(const Sk16b& other) const { |
52 return this->widenLo() * Sk4px(other).widenLo(); | 54 return this->widenLo() * Sk4px(other).widenLo(); |
53 } | 55 } |
54 | 56 |
55 inline Sk4px Sk4px::Wide::addNarrowHi(const Sk16h& other) const { | 57 inline Sk4px Sk4px::Wide::addNarrowHi(const Sk16h& other) const { |
56 Sk4px::Wide r = (*this + other) >> 8; | 58 Sk4px::Wide r = (*this + other) >> 8; |
57 return Sk16b(r.kth< 0>(), r.kth< 1>(), r.kth< 2>(), r.kth< 3>(), | 59 return Sk16b(r.kth< 0>(), r.kth< 1>(), r.kth< 2>(), r.kth< 3>(), |
58 r.kth< 4>(), r.kth< 5>(), r.kth< 6>(), r.kth< 7>(), | 60 r.kth< 4>(), r.kth< 5>(), r.kth< 6>(), r.kth< 7>(), |
59 r.kth< 8>(), r.kth< 9>(), r.kth<10>(), r.kth<11>(), | 61 r.kth< 8>(), r.kth< 9>(), r.kth<10>(), r.kth<11>(), |
60 r.kth<12>(), r.kth<13>(), r.kth<14>(), r.kth<15>()); | 62 r.kth<12>(), r.kth<13>(), r.kth<14>(), r.kth<15>()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 94 |
93 inline Sk4px Sk4px::zeroColors() const { | 95 inline Sk4px Sk4px::zeroColors() const { |
94 static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); | 96 static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); |
95 return Sk16b(0,0,0, this->kth< 3>(), | 97 return Sk16b(0,0,0, this->kth< 3>(), |
96 0,0,0, this->kth< 7>(), | 98 0,0,0, this->kth< 7>(), |
97 0,0,0, this->kth<11>(), | 99 0,0,0, this->kth<11>(), |
98 0,0,0, this->kth<15>()); | 100 0,0,0, this->kth<15>()); |
99 } | 101 } |
100 | 102 |
101 } // namespace | 103 } // namespace |
OLD | NEW |