OLD | NEW |
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" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // TODO: Remove these, and replace with more generic constructors. | 155 // TODO: Remove these, and replace with more generic constructors. |
156 static ColorSpace CreateJpeg(); | 156 static ColorSpace CreateJpeg(); |
157 static ColorSpace CreateREC601(); | 157 static ColorSpace CreateREC601(); |
158 static ColorSpace CreateREC709(); | 158 static ColorSpace CreateREC709(); |
159 | 159 |
160 bool operator==(const ColorSpace& other) const; | 160 bool operator==(const ColorSpace& other) const; |
161 bool operator!=(const ColorSpace& other) const; | 161 bool operator!=(const ColorSpace& other) const; |
162 bool operator<(const ColorSpace& other) const; | 162 bool operator<(const ColorSpace& other) const; |
163 | 163 |
164 // Note that this may return nullptr. | 164 // Note that this may return nullptr. |
165 sk_sp<SkColorSpace> ToSkColorSpace() const; | 165 const sk_sp<SkColorSpace>& ToSkColorSpace() const { return sk_color_space_; } |
166 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space); | 166 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space); |
167 | 167 |
168 private: | 168 private: |
169 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; | 169 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; |
170 TransferID transfer_ = TransferID::UNSPECIFIED; | 170 TransferID transfer_ = TransferID::UNSPECIFIED; |
171 MatrixID matrix_ = MatrixID::UNSPECIFIED; | 171 MatrixID matrix_ = MatrixID::UNSPECIFIED; |
172 RangeID range_ = RangeID::LIMITED; | 172 RangeID range_ = RangeID::LIMITED; |
173 | 173 |
174 // Only used if primaries_ == PrimaryID::CUSTOM | 174 // Only used if primaries_ == PrimaryID::CUSTOM |
175 float custom_primary_matrix_[12]; | 175 float custom_primary_matrix_[12]; |
176 | 176 |
177 // 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 |
178 // created, if possible. | 178 // created, if possible. |
179 uint64_t icc_profile_id_ = 0; | 179 uint64_t icc_profile_id_ = 0; |
180 | 180 |
181 sk_sp<SkColorSpace> sk_color_space_; | 181 sk_sp<SkColorSpace> sk_color_space_; |
182 | 182 |
183 friend class ICCProfile; | 183 friend class ICCProfile; |
184 friend class ColorSpaceToColorSpaceTransform; | 184 friend class ColorSpaceToColorSpaceTransform; |
185 friend class ColorSpaceWin; | 185 friend class ColorSpaceWin; |
186 friend struct IPC::ParamTraits<gfx::ColorSpace>; | 186 friend struct IPC::ParamTraits<gfx::ColorSpace>; |
187 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 187 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace gfx | 190 } // namespace gfx |
191 | 191 |
192 #endif // UI_GFX_COLOR_SPACE_H_ | 192 #endif // UI_GFX_COLOR_SPACE_H_ |
OLD | NEW |