OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkColor_DEFINED | 8 #ifndef SkColor_DEFINED |
9 #define SkColor_DEFINED | 9 #define SkColor_DEFINED |
10 | 10 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 B = SK_B32_SHIFT/8, | 173 B = SK_B32_SHIFT/8, |
174 }; | 174 }; |
175 float fVec[4]; | 175 float fVec[4]; |
176 | 176 |
177 float a() const { return fVec[A]; } | 177 float a() const { return fVec[A]; } |
178 | 178 |
179 SkColor4f unpremul() const; | 179 SkColor4f unpremul() const; |
180 | 180 |
181 static SkPM4f FromPMColor(SkPMColor); | 181 static SkPM4f FromPMColor(SkPMColor); |
182 | 182 |
| 183 // half-float routines |
| 184 void toF16(uint16_t[4]) const; |
| 185 uint64_t toF16() const; // 4 float16 values packed into uint64_t |
| 186 static SkPM4f FromF16(const uint16_t[4]); |
| 187 |
183 #ifdef SK_DEBUG | 188 #ifdef SK_DEBUG |
184 void assertIsUnit() const; | 189 void assertIsUnit() const; |
185 #else | 190 #else |
186 void assertIsUnit() const {} | 191 void assertIsUnit() const {} |
187 #endif | 192 #endif |
188 }; | 193 }; |
189 | 194 |
190 /* | 195 /* |
191 * The float values are 0...1 unpremultiplied | 196 * The float values are 0...1 unpremultiplied |
192 */ | 197 */ |
(...skipping 17 matching lines...) Expand all Loading... |
210 static SkColor4f FromColor(SkColor); | 215 static SkColor4f FromColor(SkColor); |
211 | 216 |
212 SkColor4f pin() const { | 217 SkColor4f pin() const { |
213 return Pin(fA, fR, fG, fB); | 218 return Pin(fA, fR, fG, fB); |
214 } | 219 } |
215 | 220 |
216 SkPM4f premul() const; | 221 SkPM4f premul() const; |
217 }; | 222 }; |
218 | 223 |
219 #endif | 224 #endif |
OLD | NEW |