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

Side by Side Diff: ui/gfx/color_space.h

Issue 2598833002: Add SkColorSpace to gfx::ColorSpace (Closed)
Patch Set: Add tests Created 3 years, 11 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 | « ui/gfx/BUILD.gn ('k') | ui/gfx/color_space.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_COLOR_SPACE_H_ 5 #ifndef UI_GFX_COLOR_SPACE_H_
6 #define UI_GFX_COLOR_SPACE_H_ 6 #define UI_GFX_COLOR_SPACE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "third_party/skia/include/core/SkColorSpace.h"
13 #include "ui/gfx/gfx_export.h" 14 #include "ui/gfx/gfx_export.h"
14 15
15 namespace IPC { 16 namespace IPC {
16 template <class P> 17 template <class P>
17 struct ParamTraits; 18 struct ParamTraits;
18 } // namespace IPC 19 } // namespace IPC
19 20
20 template <typename T>
21 class sk_sp;
22 class SkColorSpace;
23
24 namespace gfx { 21 namespace gfx {
25 22
26 class ICCProfile; 23 class ICCProfile;
27 class ColorSpaceToColorSpaceTransform; 24 class ColorSpaceToColorSpaceTransform;
28 25
29 // Used to represet a color space for the purpose of color conversion. 26 // Used to represet a color space for the purpose of color conversion.
30 // This is designed to be safe and compact enough to send over IPC 27 // This is designed to be safe and compact enough to send over IPC
31 // between any processes. 28 // between any processes.
32 class GFX_EXPORT ColorSpace { 29 class GFX_EXPORT ColorSpace {
33 public: 30 public:
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 DERIVED = 3, 134 DERIVED = 3,
138 135
139 LAST = DERIVED 136 LAST = DERIVED
140 }; 137 };
141 138
142 ColorSpace(); 139 ColorSpace();
143 ColorSpace(PrimaryID primaries, 140 ColorSpace(PrimaryID primaries,
144 TransferID transfer, 141 TransferID transfer,
145 MatrixID matrix, 142 MatrixID matrix,
146 RangeID full_range); 143 RangeID full_range);
144 ColorSpace(const ColorSpace& other);
147 ColorSpace(int primaries, int transfer, int matrix, RangeID full_range); 145 ColorSpace(int primaries, int transfer, int matrix, RangeID full_range);
146 ~ColorSpace();
148 147
149 static PrimaryID PrimaryIDFromInt(int primary_id); 148 static PrimaryID PrimaryIDFromInt(int primary_id);
150 static TransferID TransferIDFromInt(int transfer_id); 149 static TransferID TransferIDFromInt(int transfer_id);
151 static MatrixID MatrixIDFromInt(int matrix_id); 150 static MatrixID MatrixIDFromInt(int matrix_id);
152 151
153 static ColorSpace CreateSRGB(); 152 static ColorSpace CreateSRGB();
154 static ColorSpace CreateXYZD50(); 153 static ColorSpace CreateXYZD50();
155 154
156 // TODO: Remove these, and replace with more generic constructors. 155 // TODO: Remove these, and replace with more generic constructors.
157 static ColorSpace CreateJpeg(); 156 static ColorSpace CreateJpeg();
(...skipping 14 matching lines...) Expand all
172 MatrixID matrix_ = MatrixID::UNSPECIFIED; 171 MatrixID matrix_ = MatrixID::UNSPECIFIED;
173 RangeID range_ = RangeID::LIMITED; 172 RangeID range_ = RangeID::LIMITED;
174 173
175 // Only used if primaries_ == PrimaryID::CUSTOM 174 // Only used if primaries_ == PrimaryID::CUSTOM
176 float custom_primary_matrix_[12]; 175 float custom_primary_matrix_[12];
177 176
178 // This is used to look up the ICCProfile from which this ColorSpace was 177 // This is used to look up the ICCProfile from which this ColorSpace was
179 // created, if possible. 178 // created, if possible.
180 uint64_t icc_profile_id_ = 0; 179 uint64_t icc_profile_id_ = 0;
181 180
181 sk_sp<SkColorSpace> sk_color_space_;
182
182 friend class ICCProfile; 183 friend class ICCProfile;
183 friend class ColorSpaceToColorSpaceTransform; 184 friend class ColorSpaceToColorSpaceTransform;
184 friend class ColorSpaceWin; 185 friend class ColorSpaceWin;
185 friend struct IPC::ParamTraits<gfx::ColorSpace>; 186 friend struct IPC::ParamTraits<gfx::ColorSpace>;
186 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); 187 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace);
187 }; 188 };
188 189
189 } // namespace gfx 190 } // namespace gfx
190 191
191 #endif // UI_GFX_COLOR_SPACE_H_ 192 #endif // UI_GFX_COLOR_SPACE_H_
OLDNEW
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/color_space.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698