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 SkPM_DEFINED | 8 #ifndef SkPM_DEFINED |
9 #define SkPM_DEFINED | 9 #define SkPM_DEFINED |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 float a() const { return fColor[SK_A32_SHIFT / 8]; } | 51 float a() const { return fColor[SK_A32_SHIFT / 8]; } |
52 float r() const { return fColor[SK_R32_SHIFT / 8]; } | 52 float r() const { return fColor[SK_R32_SHIFT / 8]; } |
53 float g() const { return fColor[SK_G32_SHIFT / 8]; } | 53 float g() const { return fColor[SK_G32_SHIFT / 8]; } |
54 float b() const { return fColor[SK_B32_SHIFT / 8]; } | 54 float b() const { return fColor[SK_B32_SHIFT / 8]; } |
55 | 55 |
56 // get() and clamped() round component values to the nearest integer. | 56 // get() and clamped() round component values to the nearest integer. |
57 SkPMColor get() const; // May SkASSERT(this->isValid()). Some implemen
tations may clamp. | 57 SkPMColor get() const; // May SkASSERT(this->isValid()). Some implemen
tations may clamp. |
58 SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may
assert isValid(). | 58 SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may
assert isValid(). |
59 | 59 |
| 60 // Like get(), but truncates instead of rounding. |
| 61 // The domain of this function is (-1.0f, 256.0f). Values in (-1.0f, 0.0f]
trunc to a zero. |
| 62 SkPMColor trunc() const; |
| 63 |
60 // 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no al
ignment assumed. | 64 // 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no al
ignment assumed. |
61 static void To4PMColors( | 65 static void To4PMColors( |
62 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa
t&, SkPMColor[4]); | 66 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa
t&, SkPMColor[4]); |
63 static void ClampTo4PMColors( | 67 static void ClampTo4PMColors( |
64 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa
t&, SkPMColor[4]); | 68 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa
t&, SkPMColor[4]); |
65 | 69 |
66 bool isValid() const { | 70 bool isValid() const { |
67 return this->a() >= 0 && this->a() <= 255 | 71 return this->a() >= 0 && this->a() <= 255 |
68 && this->r() >= 0 && this->r() <= this->a() | 72 && this->r() >= 0 && this->r() <= this->a() |
69 && this->g() >= 0 && this->g() <= this->a() | 73 && this->g() >= 0 && this->g() <= this->a() |
(...skipping 15 matching lines...) Expand all Loading... |
85 #include "../opts/SkPMFloat_SSSE3.h" | 89 #include "../opts/SkPMFloat_SSSE3.h" |
86 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 90 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
87 #include "../opts/SkPMFloat_SSE2.h" | 91 #include "../opts/SkPMFloat_SSE2.h" |
88 #elif defined(SK_ARM_HAS_NEON) | 92 #elif defined(SK_ARM_HAS_NEON) |
89 #include "../opts/SkPMFloat_neon.h" | 93 #include "../opts/SkPMFloat_neon.h" |
90 #else | 94 #else |
91 #include "../opts/SkPMFloat_none.h" | 95 #include "../opts/SkPMFloat_none.h" |
92 #endif | 96 #endif |
93 | 97 |
94 #endif//SkPM_DEFINED | 98 #endif//SkPM_DEFINED |
OLD | NEW |