| 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 |
| 15 // 1, 2 or 4 SkPMColors, generally vectorized. | 22 // 1, 2 or 4 SkPMColors, generally vectorized. |
| 16 class Sk4px : public Sk16b { | 23 class Sk4px : public Sk16b { |
| 17 public: | 24 public: |
| 18 static Sk4px DupAlpha(SkAlpha a) { return Sk16b(a); } // a -> aaaa aaaa
aaaa aaaa | 25 static Sk4px DupAlpha(SkAlpha a) { return Sk16b(a); } // a -> aaaa aaaa
aaaa aaaa |
| 19 static Sk4px DupPMColor(SkPMColor c); // argb -> argb argb
argb argb | 26 static Sk4px DupPMColor(SkPMColor c); // argb -> argb argb
argb argb |
| 20 | 27 |
| 21 Sk4px(const Sk16b& v) : INHERITED(v) {} | 28 Sk4px(const Sk16b& v) : INHERITED(v) {} |
| 22 | 29 |
| 23 Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx | 30 Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx |
| 24 | 31 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 fn(Load1(dst), Load1(src), DupAlpha(*a)).store1(dst); | 219 fn(Load1(dst), Load1(src), DupAlpha(*a)).store1(dst); |
| 213 } | 220 } |
| 214 break; | 221 break; |
| 215 } | 222 } |
| 216 } | 223 } |
| 217 | 224 |
| 218 private: | 225 private: |
| 219 typedef Sk16b INHERITED; | 226 typedef Sk16b INHERITED; |
| 220 }; | 227 }; |
| 221 | 228 |
| 229 } // namespace |
| 230 |
| 222 #ifdef SKNX_NO_SIMD | 231 #ifdef SKNX_NO_SIMD |
| 223 #include "../opts/Sk4px_none.h" | 232 #include "../opts/Sk4px_none.h" |
| 224 #else | 233 #else |
| 225 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 234 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 226 #include "../opts/Sk4px_SSE2.h" | 235 #include "../opts/Sk4px_SSE2.h" |
| 227 #elif defined(SK_ARM_HAS_NEON) | 236 #elif defined(SK_ARM_HAS_NEON) |
| 228 #include "../opts/Sk4px_NEON.h" | 237 #include "../opts/Sk4px_NEON.h" |
| 229 #else | 238 #else |
| 230 #include "../opts/Sk4px_none.h" | 239 #include "../opts/Sk4px_none.h" |
| 231 #endif | 240 #endif |
| 232 #endif | 241 #endif |
| 233 | 242 |
| 234 #endif//Sk4px_DEFINED | 243 #endif//Sk4px_DEFINED |
| OLD | NEW |