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 SkPM4fPriv_DEFINED |
| 9 #define SkPM4fPriv_DEFINED |
| 10 |
8 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
9 #include "SkPM4f.h" | 12 #include "SkPM4f.h" |
10 | 13 |
11 static inline float get_alpha(const Sk4f& f4) { | 14 static inline float get_alpha(const Sk4f& f4) { |
12 return f4[SkPM4f::A]; | 15 return f4[SkPM4f::A]; |
13 } | 16 } |
14 | 17 |
15 static inline Sk4f set_alpha(const Sk4f& f4, float alpha) { | 18 static inline Sk4f set_alpha(const Sk4f& f4, float alpha) { |
16 static_assert(3 == SkPM4f::A, ""); | 19 static_assert(3 == SkPM4f::A, ""); |
17 return Sk4f(f4[0], f4[1], f4[2], alpha); | 20 return Sk4f(f4[0], f4[1], f4[2], alpha); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return srgb_to_linear(to_4f(src) * Sk4f(1.0f/255)); | 52 return srgb_to_linear(to_4f(src) * Sk4f(1.0f/255)); |
50 } | 53 } |
51 | 54 |
52 static inline uint32_t Sk4f_toL32(const Sk4f& x4) { | 55 static inline uint32_t Sk4f_toL32(const Sk4f& x4) { |
53 return to_4b(x4 * Sk4f(255) + Sk4f(0.5f)); | 56 return to_4b(x4 * Sk4f(255) + Sk4f(0.5f)); |
54 } | 57 } |
55 | 58 |
56 static inline uint32_t Sk4f_toS32(const Sk4f& x4) { | 59 static inline uint32_t Sk4f_toS32(const Sk4f& x4) { |
57 return to_4b(linear_to_srgb(x4) * Sk4f(255) + Sk4f(0.5f)); | 60 return to_4b(linear_to_srgb(x4) * Sk4f(255) + Sk4f(0.5f)); |
58 } | 61 } |
| 62 |
| 63 #endif |
OLD | NEW |