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 SkColorSpace_DEFINED | 8 #ifndef SkColorSpace_DEFINED |
9 #define SkColorSpace_DEFINED | 9 #define SkColorSpace_DEFINED |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 void dump() const; | 29 void dump() const; |
30 }; | 30 }; |
31 | 31 |
32 struct SkFloat3x3 { | 32 struct SkFloat3x3 { |
33 float fMat[9]; | 33 float fMat[9]; |
34 | 34 |
35 void dump() const; | 35 void dump() const; |
36 }; | 36 }; |
37 | 37 |
| 38 struct SkColorLookUpTable { |
| 39 static const uint8_t kMaxChannels = 16; |
| 40 |
| 41 uint8_t fInputChannels; |
| 42 uint8_t fOutputChannels; |
| 43 uint8_t fGridPoints[kMaxChannels]; |
| 44 std::unique_ptr<float[]> fTable; |
| 45 |
| 46 SkColorLookUpTable() { |
| 47 memset(this, 0, sizeof(struct SkColorLookUpTable)); |
| 48 } |
| 49 }; |
| 50 |
38 struct SkPM4f; | 51 struct SkPM4f; |
39 void SkApply3x3ToPM4f(const SkFloat3x3&, const SkPM4f src[], SkPM4f dst[], int c
ount); | 52 void SkApply3x3ToPM4f(const SkFloat3x3&, const SkPM4f src[], SkPM4f dst[], int c
ount); |
40 | 53 |
41 class SkColorSpace : public SkRefCnt { | 54 class SkColorSpace : public SkRefCnt { |
42 public: | 55 public: |
43 enum Named { | 56 enum Named { |
44 kUnknown_Named, | 57 kUnknown_Named, |
45 kDevice_Named, | 58 kDevice_Named, |
46 kSRGB_Named, | 59 kSRGB_Named, |
47 }; | 60 }; |
(...skipping 20 matching lines...) Expand all Loading... |
68 | 81 |
69 /** | 82 /** |
70 * Given a src and dst colorspace, return the 3x3 matrix that will convert
src_linear_RGB | 83 * Given a src and dst colorspace, return the 3x3 matrix that will convert
src_linear_RGB |
71 * values into dst_linear_RGB values. | 84 * values into dst_linear_RGB values. |
72 */ | 85 */ |
73 static Result Concat(const SkColorSpace* src, const SkColorSpace* dst, SkFlo
at3x3* result); | 86 static Result Concat(const SkColorSpace* src, const SkColorSpace* dst, SkFlo
at3x3* result); |
74 | 87 |
75 static void Test(); | 88 static void Test(); |
76 void dump() const; | 89 void dump() const; |
77 | 90 |
78 protected: | 91 private: |
79 SkColorSpace(const SkFloat3x3& toXYZ, const SkFloat3& gamma, Named); | 92 SkColorSpace(const SkFloat3& gamma, const SkFloat3x3& toXYZ, Named); |
80 | 93 |
81 private: | 94 SkColorSpace(SkColorLookUpTable colorLUT, const SkFloat3& gamma, const SkFlo
at3x3& toXYZ, |
82 const SkFloat3x3 fToXYZD50; | 95 const SkFloat3& toXYZOffset); |
83 const SkFloat3 fGamma; | 96 |
84 const uint32_t fUniqueID; | 97 const SkColorLookUpTable fColorLUT; |
85 const Named fNamed; | 98 const SkFloat3 fGamma; |
| 99 const SkFloat3x3 fToXYZD50; |
| 100 const SkFloat3 fToXYZOffset; |
| 101 |
| 102 const uint32_t fUniqueID; |
| 103 const Named fNamed; |
86 }; | 104 }; |
87 | 105 |
88 #endif | 106 #endif |
OLD | NEW |