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" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
14 | 14 |
15 namespace IPC { | 15 namespace IPC { |
16 template <class P> | 16 template <class P> |
17 struct ParamTraits; | 17 struct ParamTraits; |
18 } // namespace IPC | 18 } // namespace IPC |
19 | 19 |
| 20 template <typename T> |
| 21 class sk_sp; |
| 22 class SkColorSpace; |
| 23 |
20 namespace gfx { | 24 namespace gfx { |
21 | 25 |
22 class ICCProfile; | 26 class ICCProfile; |
23 class ColorSpaceToColorSpaceTransform; | 27 class ColorSpaceToColorSpaceTransform; |
24 | 28 |
25 // Used to represet a color space for the purpose of color conversion. | 29 // Used to represet a color space for the purpose of color conversion. |
26 // This is designed to be safe and compact enough to send over IPC | 30 // This is designed to be safe and compact enough to send over IPC |
27 // between any processes. | 31 // between any processes. |
28 class GFX_EXPORT ColorSpace { | 32 class GFX_EXPORT ColorSpace { |
29 public: | 33 public: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 129 |
126 // TODO: Remove these, and replace with more generic constructors. | 130 // TODO: Remove these, and replace with more generic constructors. |
127 static ColorSpace CreateJpeg(); | 131 static ColorSpace CreateJpeg(); |
128 static ColorSpace CreateREC601(); | 132 static ColorSpace CreateREC601(); |
129 static ColorSpace CreateREC709(); | 133 static ColorSpace CreateREC709(); |
130 | 134 |
131 bool operator==(const ColorSpace& other) const; | 135 bool operator==(const ColorSpace& other) const; |
132 bool operator!=(const ColorSpace& other) const; | 136 bool operator!=(const ColorSpace& other) const; |
133 bool operator<(const ColorSpace& other) const; | 137 bool operator<(const ColorSpace& other) const; |
134 | 138 |
| 139 // Note that this may return nullptr. |
| 140 sk_sp<SkColorSpace> ToSkColorSpace() const; |
| 141 |
135 private: | 142 private: |
136 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; | 143 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; |
137 TransferID transfer_ = TransferID::UNSPECIFIED; | 144 TransferID transfer_ = TransferID::UNSPECIFIED; |
138 MatrixID matrix_ = MatrixID::UNSPECIFIED; | 145 MatrixID matrix_ = MatrixID::UNSPECIFIED; |
139 RangeID range_ = RangeID::LIMITED; | 146 RangeID range_ = RangeID::LIMITED; |
140 | 147 |
141 // Only used if primaries_ == PrimaryID::CUSTOM | 148 // Only used if primaries_ == PrimaryID::CUSTOM |
142 float custom_primary_matrix_[12]; | 149 float custom_primary_matrix_[12]; |
143 | 150 |
144 // This is used to look up the ICCProfile from which this ColorSpace was | 151 // This is used to look up the ICCProfile from which this ColorSpace was |
145 // created, if possible. | 152 // created, if possible. |
146 uint64_t icc_profile_id_ = 0; | 153 uint64_t icc_profile_id_ = 0; |
147 | 154 |
148 friend class ICCProfile; | 155 friend class ICCProfile; |
149 friend class ColorSpaceToColorSpaceTransform; | 156 friend class ColorSpaceToColorSpaceTransform; |
150 friend struct IPC::ParamTraits<gfx::ColorSpace>; | 157 friend struct IPC::ParamTraits<gfx::ColorSpace>; |
151 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 158 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
152 }; | 159 }; |
153 | 160 |
154 } // namespace gfx | 161 } // namespace gfx |
155 | 162 |
156 #endif // UI_GFX_COLOR_SPACE_H_ | 163 #endif // UI_GFX_COLOR_SPACE_H_ |
OLD | NEW |