Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/core/SkColorSpace.h

Issue 1925753002: Parse A2B0 tag on ICC profiles (Closed) Base URL: https://skia.googlesource.com/skia.git@sanity-icc-parse
Patch Set: Explicit move constructor for MSVS 2013 Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkColorSpace.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 SkColorLookUpTable(SkColorLookUpTable&& that)
51 : fInputChannels(that.fInputChannels)
52 , fOutputChannels(that.fOutputChannels)
53 , fTable(std::move(that.fTable))
54 {
55 memcpy(fGridPoints, that.fGridPoints, kMaxChannels);
56 }
57 };
58
38 struct SkPM4f; 59 struct SkPM4f;
39 void SkApply3x3ToPM4f(const SkFloat3x3&, const SkPM4f src[], SkPM4f dst[], int c ount); 60 void SkApply3x3ToPM4f(const SkFloat3x3&, const SkPM4f src[], SkPM4f dst[], int c ount);
40 61
41 class SkColorSpace : public SkRefCnt { 62 class SkColorSpace : public SkRefCnt {
42 public: 63 public:
43 enum Named { 64 enum Named {
44 kUnknown_Named, 65 kUnknown_Named,
45 kDevice_Named, 66 kDevice_Named,
46 kSRGB_Named, 67 kSRGB_Named,
47 }; 68 };
48 69
49 /** 70 /**
50 * Return a colorspace instance, given a 3x3 transform from linear_RGB to D 50_XYZ 71 * Return a colorspace instance, given a 3x3 transform from linear_RGB to D 50_XYZ
51 * and the src-gamma, return a ColorSpace 72 * and the src-gamma, return a ColorSpace
52 */ 73 */
53 static sk_sp<SkColorSpace> NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3 & gamma); 74 static sk_sp<SkColorSpace> NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3 & gamma);
54 75
55 static sk_sp<SkColorSpace> NewNamed(Named); 76 static sk_sp<SkColorSpace> NewNamed(Named);
56 static sk_sp<SkColorSpace> NewICC(const void*, size_t); 77 static sk_sp<SkColorSpace> NewICC(const void*, size_t);
57 78
58 SkFloat3 gamma() const { return fGamma; } 79 SkFloat3 gamma() const { return fGamma; }
59 SkFloat3x3 xyz() const { return fToXYZD50; } 80 SkFloat3x3 xyz() const { return fToXYZD50; }
81 SkFloat3 xyzOffset() const { return fToXYZOffset; }
60 Named named() const { return fNamed; } 82 Named named() const { return fNamed; }
61 uint32_t uniqueID() const { return fUniqueID; } 83 uint32_t uniqueID() const { return fUniqueID; }
62 84
63 enum Result { 85 enum Result {
64 kFailure_Result, 86 kFailure_Result,
65 kIdentity_Result, 87 kIdentity_Result,
66 kNormal_Result, 88 kNormal_Result,
67 }; 89 };
68 90
69 /** 91 /**
70 * Given a src and dst colorspace, return the 3x3 matrix that will convert src_linear_RGB 92 * Given a src and dst colorspace, return the 3x3 matrix that will convert src_linear_RGB
71 * values into dst_linear_RGB values. 93 * values into dst_linear_RGB values.
72 */ 94 */
73 static Result Concat(const SkColorSpace* src, const SkColorSpace* dst, SkFlo at3x3* result); 95 static Result Concat(const SkColorSpace* src, const SkColorSpace* dst, SkFlo at3x3* result);
74 96
75 static void Test(); 97 static void Test();
76 void dump() const; 98 void dump() const;
77 99
78 protected: 100 private:
79 SkColorSpace(const SkFloat3x3& toXYZ, const SkFloat3& gamma, Named); 101 SkColorSpace(const SkFloat3& gamma, const SkFloat3x3& toXYZ, Named);
80 102
81 private: 103 SkColorSpace(SkColorLookUpTable colorLUT, const SkFloat3& gamma, const SkFlo at3x3& toXYZ,
82 const SkFloat3x3 fToXYZD50; 104 const SkFloat3& toXYZOffset);
83 const SkFloat3 fGamma; 105
84 const uint32_t fUniqueID; 106 const SkColorLookUpTable fColorLUT;
85 const Named fNamed; 107 const SkFloat3 fGamma;
108 const SkFloat3x3 fToXYZD50;
109 const SkFloat3 fToXYZOffset;
110
111 const uint32_t fUniqueID;
112 const Named fNamed;
86 }; 113 };
87 114
88 #endif 115 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkColorSpace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698