OLD | NEW |
1 #ifndef SkPM_DEFINED | 1 #ifndef SkPM_DEFINED |
2 #define SkPM_DEFINED | 2 #define SkPM_DEFINED |
3 | 3 |
4 #include "SkTypes.h" | 4 #include "SkTypes.h" |
5 #include "SkColor.h" | 5 #include "SkColor.h" |
6 #include "SkColorPriv.h" | 6 #include "SkColorPriv.h" |
7 #include "Sk4x.h" | 7 #include "Sk4x.h" |
8 | 8 |
9 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 9 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
10 #include <immintrin.h> | 10 #include <immintrin.h> |
(...skipping 20 matching lines...) Expand all Loading... |
31 fColor[SK_B32_SHIFT / 8] = b; | 31 fColor[SK_B32_SHIFT / 8] = b; |
32 } | 32 } |
33 | 33 |
34 // Uninitialized. | 34 // Uninitialized. |
35 SkPMFloat() {} | 35 SkPMFloat() {} |
36 | 36 |
37 SkPMFloat(const SkPMFloat& that) { *this = that; } | 37 SkPMFloat(const SkPMFloat& that) { *this = that; } |
38 SkPMFloat& operator=(const SkPMFloat& that); | 38 SkPMFloat& operator=(const SkPMFloat& that); |
39 | 39 |
40 // Freely autoconvert between SkPMFloat and Sk4f. They're always byte-for-b
yte identical. | 40 // Freely autoconvert between SkPMFloat and Sk4f. They're always byte-for-b
yte identical. |
41 /*implicit*/ SkPMFloat(const Sk4f& fs) { *(Sk4f*)this = fs; } | 41 /*implicit*/ SkPMFloat(const Sk4f& fs) { fs.storeAligned(fColor); } |
42 /*implicit*/ operator Sk4f() const { return *(const Sk4f*)this; } | 42 /*implicit*/ operator Sk4f() const { return Sk4f::LoadAligned(fColor); } |
43 | 43 |
44 float a() const { return fColor[SK_A32_SHIFT / 8]; } | 44 float a() const { return fColor[SK_A32_SHIFT / 8]; } |
45 float r() const { return fColor[SK_R32_SHIFT / 8]; } | 45 float r() const { return fColor[SK_R32_SHIFT / 8]; } |
46 float g() const { return fColor[SK_G32_SHIFT / 8]; } | 46 float g() const { return fColor[SK_G32_SHIFT / 8]; } |
47 float b() const { return fColor[SK_B32_SHIFT / 8]; } | 47 float b() const { return fColor[SK_B32_SHIFT / 8]; } |
48 | 48 |
49 // get() and clamped() round component values to the nearest integer. | 49 // get() and clamped() round component values to the nearest integer. |
50 SkPMColor get() const; // May SkASSERT(this->isValid()). Some implemen
tations may clamp. | 50 SkPMColor get() const; // May SkASSERT(this->isValid()). Some implemen
tations may clamp. |
51 SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may
assert isValid(). | 51 SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may
assert isValid(). |
52 | 52 |
(...skipping 23 matching lines...) Expand all Loading... |
76 #include "../opts/SkPMFloat_SSSE3.h" | 76 #include "../opts/SkPMFloat_SSSE3.h" |
77 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 77 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
78 #include "../opts/SkPMFloat_SSE2.h" | 78 #include "../opts/SkPMFloat_SSE2.h" |
79 #elif defined(SK_ARM_HAS_NEON) | 79 #elif defined(SK_ARM_HAS_NEON) |
80 #include "../opts/SkPMFloat_neon.h" | 80 #include "../opts/SkPMFloat_neon.h" |
81 #else | 81 #else |
82 #include "../opts/SkPMFloat_none.h" | 82 #include "../opts/SkPMFloat_none.h" |
83 #endif | 83 #endif |
84 | 84 |
85 #endif//SkPM_DEFINED | 85 #endif//SkPM_DEFINED |
OLD | NEW |