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 Sk4px_DEFINED | 8 #ifndef Sk4px_DEFINED |
9 #define Sk4px_DEFINED | 9 #define Sk4px_DEFINED |
10 | 10 |
11 #include "SkNx.h" | 11 #include "SkNx.h" |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 | 13 |
| 14 // This file may be included multiple times by .cpp files with different flags,
leading |
| 15 // to different definitions. Usually that doesn't matter because it's all inlin
ed, but |
| 16 // in Debug modes the compilers may not inline everything. So wrap everything i
n an |
| 17 // anonymous namespace to give each includer their own silo of this code (or the
linker |
| 18 // will probably pick one randomly for us, which is rarely correct). |
| 19 namespace { |
| 20 |
14 // 1, 2 or 4 SkPMColors, generally vectorized. | 21 // 1, 2 or 4 SkPMColors, generally vectorized. |
15 class Sk4px : public Sk16b { | 22 class Sk4px : public Sk16b { |
16 public: | 23 public: |
17 Sk4px(SkAlpha a) : INHERITED(a) {} // Duplicate 16x: a -> aaaa aaaa aaaa
aaaa | 24 Sk4px(SkAlpha a) : INHERITED(a) {} // Duplicate 16x: a -> aaaa aaaa aaaa
aaaa |
18 Sk4px(SkPMColor); // Duplicate 4x: argb -> argb argb argb
argb | 25 Sk4px(SkPMColor); // Duplicate 4x: argb -> argb argb argb
argb |
19 Sk4px(const Sk16b& v) : INHERITED(v) {} | 26 Sk4px(const Sk16b& v) : INHERITED(v) {} |
20 | 27 |
21 Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx | 28 Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx |
22 | 29 |
23 // Mask away color or alpha lanes. | 30 // Mask away color or alpha lanes. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 fn(Load1(dst), Load1(src), alpha).store1(dst); | 171 fn(Load1(dst), Load1(src), alpha).store1(dst); |
165 } | 172 } |
166 break; | 173 break; |
167 } | 174 } |
168 } | 175 } |
169 | 176 |
170 private: | 177 private: |
171 typedef Sk16b INHERITED; | 178 typedef Sk16b INHERITED; |
172 }; | 179 }; |
173 | 180 |
| 181 } // namespace |
| 182 |
174 #ifdef SKNX_NO_SIMD | 183 #ifdef SKNX_NO_SIMD |
175 #include "../opts/Sk4px_none.h" | 184 #include "../opts/Sk4px_none.h" |
176 #else | 185 #else |
177 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 186 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
178 #include "../opts/Sk4px_SSE2.h" | 187 #include "../opts/Sk4px_SSE2.h" |
179 #elif defined(SK_ARM_HAS_NEON) | 188 #elif defined(SK_ARM_HAS_NEON) |
180 #include "../opts/Sk4px_NEON.h" | 189 #include "../opts/Sk4px_NEON.h" |
181 #else | 190 #else |
182 #include "../opts/Sk4px_none.h" | 191 #include "../opts/Sk4px_none.h" |
183 #endif | 192 #endif |
184 #endif | 193 #endif |
185 | 194 |
186 #endif//Sk4px_DEFINED | 195 #endif//Sk4px_DEFINED |
OLD | NEW |