| 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 sk_sp<SkColorSpace> ToSkColorSpace() const; |
| 140 |
| 135 private: | 141 private: |
| 136 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; | 142 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; |
| 137 TransferID transfer_ = TransferID::UNSPECIFIED; | 143 TransferID transfer_ = TransferID::UNSPECIFIED; |
| 138 MatrixID matrix_ = MatrixID::UNSPECIFIED; | 144 MatrixID matrix_ = MatrixID::UNSPECIFIED; |
| 139 RangeID range_ = RangeID::LIMITED; | 145 RangeID range_ = RangeID::LIMITED; |
| 140 | 146 |
| 141 // Only used if primaries_ == PrimaryID::CUSTOM | 147 // Only used if primaries_ == PrimaryID::CUSTOM |
| 142 float custom_primary_matrix_[12]; | 148 float custom_primary_matrix_[12]; |
| 143 | 149 |
| 144 // This is used to look up the ICCProfile from which this ColorSpace was | 150 // This is used to look up the ICCProfile from which this ColorSpace was |
| 145 // created, if possible. | 151 // created, if possible. |
| 146 uint64_t icc_profile_id_ = 0; | 152 uint64_t icc_profile_id_ = 0; |
| 147 | 153 |
| 148 friend class ICCProfile; | 154 friend class ICCProfile; |
| 149 friend class ColorSpaceToColorSpaceTransform; | 155 friend class ColorSpaceToColorSpaceTransform; |
| 150 friend struct IPC::ParamTraits<gfx::ColorSpace>; | 156 friend struct IPC::ParamTraits<gfx::ColorSpace>; |
| 151 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 157 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
| 152 }; | 158 }; |
| 153 | 159 |
| 154 } // namespace gfx | 160 } // namespace gfx |
| 155 | 161 |
| 156 #endif // UI_GFX_COLOR_SPACE_H_ | 162 #endif // UI_GFX_COLOR_SPACE_H_ |
| OLD | NEW |