Chromium Code Reviews| 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. | |
|
reed1
2015/03/26 13:05:10
floor or (int) ?
i.e. can you document what happen
mtklein
2015/03/26 13:26:25
Done.
// The domain of this function is (-1.0f, 2
| |
| 61 SkPMColor trunc() const; | |
| 62 | |
| 60 // 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no al ignment assumed. | 63 // 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no al ignment assumed. |
| 61 static void To4PMColors( | 64 static void To4PMColors( |
| 62 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]); | 65 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]); |
| 63 static void ClampTo4PMColors( | 66 static void ClampTo4PMColors( |
| 64 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]); | 67 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]); |
| 65 | 68 |
| 66 bool isValid() const { | 69 bool isValid() const { |
| 67 return this->a() >= 0 && this->a() <= 255 | 70 return this->a() >= 0 && this->a() <= 255 |
| 68 && this->r() >= 0 && this->r() <= this->a() | 71 && this->r() >= 0 && this->r() <= this->a() |
| 69 && this->g() >= 0 && this->g() <= this->a() | 72 && this->g() >= 0 && this->g() <= this->a() |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 85 #include "../opts/SkPMFloat_SSSE3.h" | 88 #include "../opts/SkPMFloat_SSSE3.h" |
| 86 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 89 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 87 #include "../opts/SkPMFloat_SSE2.h" | 90 #include "../opts/SkPMFloat_SSE2.h" |
| 88 #elif defined(SK_ARM_HAS_NEON) | 91 #elif defined(SK_ARM_HAS_NEON) |
| 89 #include "../opts/SkPMFloat_neon.h" | 92 #include "../opts/SkPMFloat_neon.h" |
| 90 #else | 93 #else |
| 91 #include "../opts/SkPMFloat_none.h" | 94 #include "../opts/SkPMFloat_none.h" |
| 92 #endif | 95 #endif |
| 93 | 96 |
| 94 #endif//SkPM_DEFINED | 97 #endif//SkPM_DEFINED |
| OLD | NEW |