OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 SkPM4f_DEFINED | 8 #ifndef SkPM4f_DEFINED |
9 #define SkPM4f_DEFINED | 9 #define SkPM4f_DEFINED |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 return pm; | 43 return pm; |
44 } | 44 } |
45 static SkPM4f FromF16(const uint16_t[4]); | 45 static SkPM4f FromF16(const uint16_t[4]); |
46 static SkPM4f FromPMColor(SkPMColor); | 46 static SkPM4f FromPMColor(SkPMColor); |
47 | 47 |
48 Sk4f to4f() const { return Sk4f::Load(fVec); } | 48 Sk4f to4f() const { return Sk4f::Load(fVec); } |
49 Sk4f to4f_rgba() const { return this->to4f(); } | 49 Sk4f to4f_rgba() const { return this->to4f(); } |
50 Sk4f to4f_bgra() const { return swizzle_rb(this->to4f()); } | 50 Sk4f to4f_bgra() const { return swizzle_rb(this->to4f()); } |
51 Sk4f to4f_pmorder() const { return swizzle_rb_if_bgra(this->to4f()); } | 51 Sk4f to4f_pmorder() const { return swizzle_rb_if_bgra(this->to4f()); } |
52 | 52 |
| 53 SkPMColor toPMColor() const { |
| 54 Sk4f value = swizzle_rb_if_bgra(this->to4f()); |
| 55 SkPMColor result; |
| 56 SkNx_cast<uint8_t>(value * Sk4f(255) + Sk4f(0.5f)).store(&result); |
| 57 return result; |
| 58 } |
| 59 |
53 void toF16(uint16_t[4]) const; | 60 void toF16(uint16_t[4]) const; |
54 uint64_t toF16() const; // 4 float16 values packed into uint64_t | 61 uint64_t toF16() const; // 4 float16 values packed into uint64_t |
55 | 62 |
56 SkColor4f unpremul() const; | 63 SkColor4f unpremul() const; |
57 | 64 |
58 #ifdef SK_DEBUG | 65 #ifdef SK_DEBUG |
59 void assertIsUnit() const; | 66 void assertIsUnit() const; |
60 #else | 67 #else |
61 void assertIsUnit() const {} | 68 void assertIsUnit() const {} |
62 #endif | 69 #endif |
63 }; | 70 }; |
64 | 71 |
65 typedef SkPM4f (*SkXfermodeProc4f)(const SkPM4f& src, const SkPM4f& dst); | 72 typedef SkPM4f (*SkXfermodeProc4f)(const SkPM4f& src, const SkPM4f& dst); |
66 | 73 |
67 #endif | 74 #endif |
OLD | NEW |