| 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 // 1, 2 or 4 SkPMColors, generally vectorized. | 14 // 1, 2 or 4 SkPMColors, generally vectorized. |
| 15 class Sk4px : public Sk16b { | 15 class Sk4px : public Sk16b { |
| 16 public: | 16 public: |
| 17 Sk4px(SkAlpha a) : INHERITED(a) {} // Duplicate 16x. | 17 Sk4px(SkAlpha a) : INHERITED(a) {} // Duplicate 16x: a -> aaaa aaaa aaaa
aaaa |
| 18 Sk4px(SkPMColor); // Duplicate 4x. | 18 Sk4px(SkPMColor); // Duplicate 4x: argb -> argb argb argb
argb |
| 19 Sk4px(const Sk16b& v) : INHERITED(v) {} | 19 Sk4px(const Sk16b& v) : INHERITED(v) {} |
| 20 | 20 |
| 21 // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx | 21 Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx |
| 22 Sk4px alphas() const; | 22 |
| 23 Sk4px inv() const { return Sk16b(255) - *this; } |
| 23 | 24 |
| 24 // When loading or storing fewer than 4 SkPMColors, we use the low lanes. | 25 // When loading or storing fewer than 4 SkPMColors, we use the low lanes. |
| 25 static Sk4px Load4(const SkPMColor[4]); | 26 static Sk4px Load4(const SkPMColor[4]); // PMColor[4] -> ARGB argb XYZW xyz
w |
| 26 static Sk4px Load2(const SkPMColor[2]); | 27 static Sk4px Load2(const SkPMColor[2]); // PMColor[2] -> ARGB argb ???? ???
? |
| 27 static Sk4px Load1(const SkPMColor[1]); | 28 static Sk4px Load1(const SkPMColor[1]); // PMColor[1] -> ARGB ???? ???? ???
? |
| 28 | 29 |
| 29 // Ditto for Alphas... Load2Alphas fills the low two lanes of Sk4px. | 30 // Ditto for Alphas... Load2Alphas fills the low two lanes of Sk4px. |
| 30 static Sk4px Load4Alphas(const SkAlpha[4]); // AaXx -> AAAA aaaa XXXX xxxx | 31 static Sk4px Load4Alphas(const SkAlpha[4]); // AaXx -> AAAA aaaa XXXX xxxx |
| 31 static Sk4px Load2Alphas(const SkAlpha[2]); // Aa -> AAAA aaaa 0000 0000 | 32 static Sk4px Load2Alphas(const SkAlpha[2]); // Aa -> AAAA aaaa ???? ???? |
| 32 | 33 |
| 33 void store4(SkPMColor[4]) const; | 34 void store4(SkPMColor[4]) const; |
| 34 void store2(SkPMColor[2]) const; | 35 void store2(SkPMColor[2]) const; |
| 35 void store1(SkPMColor[1]) const; | 36 void store1(SkPMColor[1]) const; |
| 36 | 37 |
| 37 // 1, 2, or 4 SkPMColors with 16-bit components. | 38 // 1, 2, or 4 SkPMColors with 16-bit components. |
| 38 // This is most useful as the result of a multiply, e.g. from mulWiden(). | 39 // This is most useful as the result of a multiply, e.g. from mulWiden(). |
| 39 class Wide : public Sk16h { | 40 class Wide : public Sk16h { |
| 40 public: | 41 public: |
| 41 Wide(const Sk16h& v) : Sk16h(v) {} | 42 Wide(const Sk16h& v) : Sk16h(v) {} |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 160 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 160 #include "../opts/Sk4px_SSE2.h" | 161 #include "../opts/Sk4px_SSE2.h" |
| 161 #elif defined(SK_ARM_HAS_NEON) | 162 #elif defined(SK_ARM_HAS_NEON) |
| 162 #include "../opts/Sk4px_NEON.h" | 163 #include "../opts/Sk4px_NEON.h" |
| 163 #else | 164 #else |
| 164 #include "../opts/Sk4px_none.h" | 165 #include "../opts/Sk4px_none.h" |
| 165 #endif | 166 #endif |
| 166 #endif | 167 #endif |
| 167 | 168 |
| 168 #endif//Sk4px_DEFINED | 169 #endif//Sk4px_DEFINED |
| OLD | NEW |