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

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

Issue 2085653003: Enable flattening and unflattening of SkColorSpace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit tests Created 4 years, 6 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 | include/core/SkMatrix44.h » ('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
11 #include "SkMatrix44.h" 11 #include "SkMatrix44.h"
12 #include "SkRefCnt.h" 12 #include "SkRefCnt.h"
13 13
14 class SkData;
15
14 class SK_API SkColorSpace : public SkRefCnt { 16 class SK_API SkColorSpace : public SkRefCnt {
15 public: 17 public:
16 18
17 /** 19 /**
18 * Common, named profiles that we can recognize. 20 * Common, named profiles that we can recognize.
19 */ 21 */
20 enum Named { 22 enum Named {
21 kUnknown_Named, 23 kUnknown_Named,
22 kSRGB_Named, 24 kSRGB_Named,
23 kAdobeRGB_Named, 25 kAdobeRGB_Named,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 */ 70 */
69 const SkMatrix44& xyz() const { return fToXYZD50; } 71 const SkMatrix44& xyz() const { return fToXYZD50; }
70 72
71 /** 73 /**
72 * Returns true if the color space gamma is near enough to be approximated as sRGB. 74 * Returns true if the color space gamma is near enough to be approximated as sRGB.
73 */ 75 */
74 bool gammaCloseToSRGB() const { 76 bool gammaCloseToSRGB() const {
75 return kSRGB_GammaNamed == fGammaNamed || k2Dot2Curve_GammaNamed == fGam maNamed; 77 return kSRGB_GammaNamed == fGammaNamed || k2Dot2Curve_GammaNamed == fGam maNamed;
76 } 78 }
77 79
80 /**
81 * Returns nullptr on failure. Fails when we fallback to serializing ICC d ata and
82 * the data is too large to serialize.
83 */
84 sk_sp<SkData> serialize() const;
85
86 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length);
87
78 protected: 88 protected:
79 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named) ; 89 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named) ;
80 90
81 friend Named sk_deduce_named_from_colorspace(SkColorSpace*);
82
83 const GammaNamed fGammaNamed; 91 const GammaNamed fGammaNamed;
84 const SkMatrix44 fToXYZD50; 92 const SkMatrix44 fToXYZD50;
85 const Named fNamed; 93 const Named fNamed;
86 }; 94 };
87 95
88 #endif 96 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkMatrix44.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698