Chromium Code Reviews| 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> | 20 template <typename T> |
| 21 class sk_sp; | 21 class sk_sp; |
| 22 class SkColorSpace; | 22 class SkColorSpace; |
| 23 | 23 |
| 24 namespace media { | |
| 25 class DXVAVideoDecodeAccelerator; | |
| 26 }; | |
| 27 | |
| 24 namespace gfx { | 28 namespace gfx { |
| 25 | 29 |
| 26 class ICCProfile; | 30 class ICCProfile; |
| 27 class ColorSpaceToColorSpaceTransform; | 31 class ColorSpaceToColorSpaceTransform; |
| 28 | 32 |
| 29 // Used to represet a color space for the purpose of color conversion. | 33 // 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 | 34 // This is designed to be safe and compact enough to send over IPC |
| 31 // between any processes. | 35 // between any processes. |
| 32 class GFX_EXPORT ColorSpace { | 36 class GFX_EXPORT ColorSpace { |
| 33 public: | 37 public: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 static ColorSpace CreateJpeg(); | 161 static ColorSpace CreateJpeg(); |
| 158 static ColorSpace CreateREC601(); | 162 static ColorSpace CreateREC601(); |
| 159 static ColorSpace CreateREC709(); | 163 static ColorSpace CreateREC709(); |
| 160 | 164 |
| 161 bool operator==(const ColorSpace& other) const; | 165 bool operator==(const ColorSpace& other) const; |
| 162 bool operator!=(const ColorSpace& other) const; | 166 bool operator!=(const ColorSpace& other) const; |
| 163 bool operator<(const ColorSpace& other) const; | 167 bool operator<(const ColorSpace& other) const; |
| 164 | 168 |
| 165 // Note that this may return nullptr. | 169 // Note that this may return nullptr. |
| 166 sk_sp<SkColorSpace> ToSkColorSpace() const; | 170 sk_sp<SkColorSpace> ToSkColorSpace() const; |
| 167 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space); | 171 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space); |
|
ccameron
2016/11/15 19:24:00
I think it would be better to have accessor functi
hubbe
2016/11/16 18:29:02
That seems like overkill to me.
I assume the reas
| |
| 168 | 172 |
| 169 private: | 173 private: |
| 170 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; | 174 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; |
| 171 TransferID transfer_ = TransferID::UNSPECIFIED; | 175 TransferID transfer_ = TransferID::UNSPECIFIED; |
| 172 MatrixID matrix_ = MatrixID::UNSPECIFIED; | 176 MatrixID matrix_ = MatrixID::UNSPECIFIED; |
| 173 RangeID range_ = RangeID::LIMITED; | 177 RangeID range_ = RangeID::LIMITED; |
| 174 | 178 |
| 175 // Only used if primaries_ == PrimaryID::CUSTOM | 179 // Only used if primaries_ == PrimaryID::CUSTOM |
| 176 float custom_primary_matrix_[12]; | 180 float custom_primary_matrix_[12]; |
| 177 | 181 |
| 178 // This is used to look up the ICCProfile from which this ColorSpace was | 182 // This is used to look up the ICCProfile from which this ColorSpace was |
| 179 // created, if possible. | 183 // created, if possible. |
| 180 uint64_t icc_profile_id_ = 0; | 184 uint64_t icc_profile_id_ = 0; |
| 181 | 185 |
| 182 friend class ICCProfile; | 186 friend class ICCProfile; |
| 183 friend class ColorSpaceToColorSpaceTransform; | 187 friend class ColorSpaceToColorSpaceTransform; |
| 184 friend struct IPC::ParamTraits<gfx::ColorSpace>; | 188 friend struct IPC::ParamTraits<gfx::ColorSpace>; |
| 189 friend class media::DXVAVideoDecodeAccelerator; | |
| 185 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 190 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
| 186 }; | 191 }; |
| 187 | 192 |
| 188 } // namespace gfx | 193 } // namespace gfx |
| 189 | 194 |
| 190 #endif // UI_GFX_COLOR_SPACE_H_ | 195 #endif // UI_GFX_COLOR_SPACE_H_ |
| OLD | NEW |