| 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 #include "SkColorPriv.h" | 13 #include "SkColorPriv.h" |
| 14 | 14 |
| 15 // This file may be included multiple times by .cpp files with different flags,
leading | |
| 16 // to different definitions. Usually that doesn't matter because it's all inlin
ed, but | |
| 17 // in Debug modes the compilers may not inline everything. So wrap everything i
n an | |
| 18 // anonymous namespace to give each includer their own silo of this code (or the
linker | |
| 19 // will probably pick one randomly for us, which is rarely correct). | |
| 20 namespace { | |
| 21 | |
| 22 // 1, 2 or 4 SkPMColors, generally vectorized. | 15 // 1, 2 or 4 SkPMColors, generally vectorized. |
| 23 class Sk4px : public Sk16b { | 16 class Sk4px : public Sk16b { |
| 24 public: | 17 public: |
| 25 static Sk4px DupAlpha(SkAlpha a) { return Sk16b(a); } // a -> aaaa aaaa
aaaa aaaa | 18 static Sk4px DupAlpha(SkAlpha a) { return Sk16b(a); } // a -> aaaa aaaa
aaaa aaaa |
| 26 static Sk4px DupPMColor(SkPMColor c); // argb -> argb argb
argb argb | 19 static Sk4px DupPMColor(SkPMColor c); // argb -> argb argb
argb argb |
| 27 | 20 |
| 28 Sk4px(const Sk16b& v) : INHERITED(v) {} | 21 Sk4px(const Sk16b& v) : INHERITED(v) {} |
| 29 | 22 |
| 30 Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx | 23 Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx |
| 31 | 24 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 fn(Load1(dst), Load1(src), DupAlpha(*a)).store1(dst); | 212 fn(Load1(dst), Load1(src), DupAlpha(*a)).store1(dst); |
| 220 } | 213 } |
| 221 break; | 214 break; |
| 222 } | 215 } |
| 223 } | 216 } |
| 224 | 217 |
| 225 private: | 218 private: |
| 226 typedef Sk16b INHERITED; | 219 typedef Sk16b INHERITED; |
| 227 }; | 220 }; |
| 228 | 221 |
| 229 } // namespace | |
| 230 | |
| 231 #ifdef SKNX_NO_SIMD | 222 #ifdef SKNX_NO_SIMD |
| 232 #include "../opts/Sk4px_none.h" | 223 #include "../opts/Sk4px_none.h" |
| 233 #else | 224 #else |
| 234 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 225 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 235 #include "../opts/Sk4px_SSE2.h" | 226 #include "../opts/Sk4px_SSE2.h" |
| 236 #elif defined(SK_ARM_HAS_NEON) | 227 #elif defined(SK_ARM_HAS_NEON) |
| 237 #include "../opts/Sk4px_NEON.h" | 228 #include "../opts/Sk4px_NEON.h" |
| 238 #else | 229 #else |
| 239 #include "../opts/Sk4px_none.h" | 230 #include "../opts/Sk4px_none.h" |
| 240 #endif | 231 #endif |
| 241 #endif | 232 #endif |
| 242 | 233 |
| 243 #endif//Sk4px_DEFINED | 234 #endif//Sk4px_DEFINED |
| OLD | NEW |