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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 SkNf approxInvert() const { return SkNf(fLo.approxInvert(), fHi.approxInvert
()); } | 134 SkNf approxInvert() const { return SkNf(fLo.approxInvert(), fHi.approxInvert
()); } |
135 | 135 |
136 template <int k> T kth() const { | 136 template <int k> T kth() const { |
137 SkASSERT(0 <= k && k < N); | 137 SkASSERT(0 <= k && k < N); |
138 return k < N/2 ? fLo.template kth<k>() : fHi.template kth<k-N/2>(); | 138 return k < N/2 ? fLo.template kth<k>() : fHi.template kth<k-N/2>(); |
139 } | 139 } |
140 | 140 |
141 bool allTrue() const { return fLo.allTrue() && fHi.allTrue(); } | 141 bool allTrue() const { return fLo.allTrue() && fHi.allTrue(); } |
142 bool anyTrue() const { return fLo.anyTrue() || fHi.anyTrue(); } | 142 bool anyTrue() const { return fLo.anyTrue() || fHi.anyTrue(); } |
143 SkNf thenElse(const SkNf& t, const SkNf& e) const { | 143 SkNf thenElse(const SkNf& t, const SkNf& e) const { |
144 return SkNf(fLo.thenElse(t.fLo, t.fHi), fHi.thenElse(t.fLo, t.fHi)); | 144 return SkNf(fLo.thenElse(t.fLo, e.fLo), fHi.thenElse(t.fHi, e.fHi)); |
145 } | 145 } |
146 | 146 |
147 protected: | 147 protected: |
148 REQUIRE(0 == (N & (N-1))); | 148 REQUIRE(0 == (N & (N-1))); |
149 SkNf(const SkNf<N/2, T>& lo, const SkNf<N/2, T>& hi) : fLo(lo), fHi(hi) {} | 149 SkNf(const SkNf<N/2, T>& lo, const SkNf<N/2, T>& hi) : fLo(lo), fHi(hi) {} |
150 | 150 |
151 SkNf<N/2, T> fLo, fHi; | 151 SkNf<N/2, T> fLo, fHi; |
152 }; | 152 }; |
153 | 153 |
154 | 154 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 typedef SkNi<4, uint16_t> Sk4h; | 276 typedef SkNi<4, uint16_t> Sk4h; |
277 typedef SkNi<8, uint16_t> Sk8h; | 277 typedef SkNi<8, uint16_t> Sk8h; |
278 typedef SkNi<16, uint16_t> Sk16h; | 278 typedef SkNi<16, uint16_t> Sk16h; |
279 | 279 |
280 typedef SkNi<16, uint8_t> Sk16b; | 280 typedef SkNi<16, uint8_t> Sk16b; |
281 | 281 |
282 typedef SkNi<4, int32_t> Sk4i; | 282 typedef SkNi<4, int32_t> Sk4i; |
283 typedef SkNi<4, uint32_t> Sk4u; | 283 typedef SkNi<4, uint32_t> Sk4u; |
284 | 284 |
285 #endif//SkNx_DEFINED | 285 #endif//SkNx_DEFINED |
OLD | NEW |