| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 SkColorLookUpTable(SkColorLookUpTable&& that) | 50 SkColorLookUpTable(SkColorLookUpTable&& that) |
| 51 : fInputChannels(that.fInputChannels) | 51 : fInputChannels(that.fInputChannels) |
| 52 , fOutputChannels(that.fOutputChannels) | 52 , fOutputChannels(that.fOutputChannels) |
| 53 , fTable(std::move(that.fTable)) | 53 , fTable(std::move(that.fTable)) |
| 54 { | 54 { |
| 55 memcpy(fGridPoints, that.fGridPoints, kMaxChannels); | 55 memcpy(fGridPoints, that.fGridPoints, kMaxChannels); |
| 56 } | 56 } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 struct SkPM4f; | |
| 60 void SkApply3x3ToPM4f(const SkFloat3x3&, const SkPM4f src[], SkPM4f dst[], int c
ount); | |
| 61 | |
| 62 class SkColorSpace : public SkRefCnt { | 59 class SkColorSpace : public SkRefCnt { |
| 63 public: | 60 public: |
| 64 enum Named { | 61 enum Named { |
| 65 kUnknown_Named, | 62 kUnknown_Named, |
| 66 kDevice_Named, | |
| 67 kSRGB_Named, | 63 kSRGB_Named, |
| 68 }; | 64 }; |
| 69 | 65 |
| 70 /** | 66 /** |
| 71 * Return a colorspace instance, given a 3x3 transform from linear_RGB to D
50_XYZ | 67 * Return a colorspace instance, given a 3x3 transform from linear_RGB to D
50_XYZ |
| 72 * and the src-gamma, return a ColorSpace | 68 * and the src-gamma, return a ColorSpace |
| 73 */ | 69 */ |
| 74 static sk_sp<SkColorSpace> NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3
& gamma); | 70 static sk_sp<SkColorSpace> NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3
& gamma); |
| 75 | 71 |
| 76 static sk_sp<SkColorSpace> NewNamed(Named); | 72 static sk_sp<SkColorSpace> NewNamed(Named); |
| 77 static sk_sp<SkColorSpace> NewICC(const void*, size_t); | 73 static sk_sp<SkColorSpace> NewICC(const void*, size_t); |
| 78 | 74 |
| 79 SkFloat3 gamma() const { return fGamma; } | 75 SkFloat3 gamma() const { return fGamma; } |
| 80 SkFloat3x3 xyz() const { return fToXYZD50; } | 76 SkFloat3x3 xyz() const { return fToXYZD50; } |
| 81 SkFloat3 xyzOffset() const { return fToXYZOffset; } | 77 SkFloat3 xyzOffset() const { return fToXYZOffset; } |
| 82 Named named() const { return fNamed; } | 78 Named named() const { return fNamed; } |
| 83 uint32_t uniqueID() const { return fUniqueID; } | 79 uint32_t uniqueID() const { return fUniqueID; } |
| 84 | 80 |
| 85 enum Result { | |
| 86 kFailure_Result, | |
| 87 kIdentity_Result, | |
| 88 kNormal_Result, | |
| 89 }; | |
| 90 | |
| 91 /** | |
| 92 * Given a src and dst colorspace, return the 3x3 matrix that will convert
src_linear_RGB | |
| 93 * values into dst_linear_RGB values. | |
| 94 */ | |
| 95 static Result Concat(const SkColorSpace* src, const SkColorSpace* dst, SkFlo
at3x3* result); | |
| 96 | |
| 97 static void Test(); | |
| 98 void dump() const; | |
| 99 | |
| 100 private: | 81 private: |
| 101 SkColorSpace(const SkFloat3& gamma, const SkFloat3x3& toXYZ, Named); | 82 SkColorSpace(const SkFloat3& gamma, const SkFloat3x3& toXYZ, Named); |
| 102 | 83 |
| 103 SkColorSpace(SkColorLookUpTable colorLUT, const SkFloat3& gamma, const SkFlo
at3x3& toXYZ, | 84 SkColorSpace(SkColorLookUpTable colorLUT, const SkFloat3& gamma, const SkFlo
at3x3& toXYZ, |
| 104 const SkFloat3& toXYZOffset); | 85 const SkFloat3& toXYZOffset); |
| 105 | 86 |
| 106 const SkColorLookUpTable fColorLUT; | 87 const SkColorLookUpTable fColorLUT; |
| 107 const SkFloat3 fGamma; | 88 const SkFloat3 fGamma; |
| 108 const SkFloat3x3 fToXYZD50; | 89 const SkFloat3x3 fToXYZD50; |
| 109 const SkFloat3 fToXYZOffset; | 90 const SkFloat3 fToXYZOffset; |
| 110 | 91 |
| 111 const uint32_t fUniqueID; | 92 const uint32_t fUniqueID; |
| 112 const Named fNamed; | 93 const Named fNamed; |
| 113 }; | 94 }; |
| 114 | 95 |
| 115 #endif | 96 #endif |
| OLD | NEW |