| 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 #include "ui/gfx/color_space.h" | 5 #include "ui/gfx/color_space.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // static | 81 // static |
| 82 ColorSpace ColorSpace::CreateSRGB() { | 82 ColorSpace ColorSpace::CreateSRGB() { |
| 83 ColorSpace result(PrimaryID::BT709, TransferID::IEC61966_2_1, MatrixID::RGB, | 83 ColorSpace result(PrimaryID::BT709, TransferID::IEC61966_2_1, MatrixID::RGB, |
| 84 RangeID::FULL); | 84 RangeID::FULL); |
| 85 result.sk_color_space_ = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); | 85 result.sk_color_space_ = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); |
| 86 return result; | 86 return result; |
| 87 } | 87 } |
| 88 | 88 |
| 89 // static | 89 // static |
| 90 ColorSpace ColorSpace::CreateSCRGBLinear() { | 90 ColorSpace ColorSpace::CreateSCRGBLinear() { |
| 91 return ColorSpace(PrimaryID::BT709, TransferID::LINEAR, MatrixID::RGB, | 91 return ColorSpace(PrimaryID::BT709, TransferID::LINEAR_HDR, MatrixID::RGB, |
| 92 RangeID::FULL); | 92 RangeID::FULL); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Static | 95 // Static |
| 96 ColorSpace ColorSpace::CreateXYZD50() { | 96 ColorSpace ColorSpace::CreateXYZD50() { |
| 97 return ColorSpace(PrimaryID::XYZ_D50, TransferID::LINEAR, MatrixID::RGB, | 97 return ColorSpace(PrimaryID::XYZ_D50, TransferID::LINEAR, MatrixID::RGB, |
| 98 RangeID::FULL); | 98 RangeID::FULL); |
| 99 } | 99 } |
| 100 | 100 |
| 101 // static | 101 // static |
| (...skipping 20 matching lines...) Expand all Loading... |
| 122 return false; | 122 return false; |
| 123 if (primaries_ == PrimaryID::CUSTOM && | 123 if (primaries_ == PrimaryID::CUSTOM && |
| 124 memcmp(custom_primary_matrix_, other.custom_primary_matrix_, | 124 memcmp(custom_primary_matrix_, other.custom_primary_matrix_, |
| 125 sizeof(custom_primary_matrix_))) | 125 sizeof(custom_primary_matrix_))) |
| 126 return false; | 126 return false; |
| 127 return true; | 127 return true; |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool ColorSpace::IsHDR() const { | 130 bool ColorSpace::IsHDR() const { |
| 131 return transfer_ == TransferID::SMPTEST2084 || | 131 return transfer_ == TransferID::SMPTEST2084 || |
| 132 transfer_ == TransferID::ARIB_STD_B67; | 132 transfer_ == TransferID::ARIB_STD_B67 || |
| 133 transfer_ == TransferID::LINEAR_HDR; |
| 133 } | 134 } |
| 134 | 135 |
| 135 bool ColorSpace::operator!=(const ColorSpace& other) const { | 136 bool ColorSpace::operator!=(const ColorSpace& other) const { |
| 136 return !(*this == other); | 137 return !(*this == other); |
| 137 } | 138 } |
| 138 | 139 |
| 139 bool ColorSpace::operator<(const ColorSpace& other) const { | 140 bool ColorSpace::operator<(const ColorSpace& other) const { |
| 140 if (primaries_ < other.primaries_) | 141 if (primaries_ < other.primaries_) |
| 141 return true; | 142 return true; |
| 142 if (primaries_ > other.primaries_) | 143 if (primaries_ > other.primaries_) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get())) | 175 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get())) |
| 175 return gfx::ColorSpace::CreateSRGB(); | 176 return gfx::ColorSpace::CreateSRGB(); |
| 176 | 177 |
| 177 // TODO(crbug.com/634102): Add conversion to gfx::ColorSpace for | 178 // TODO(crbug.com/634102): Add conversion to gfx::ColorSpace for |
| 178 // non-ICC-profile based color spaces. | 179 // non-ICC-profile based color spaces. |
| 179 ICCProfile icc_profile = ICCProfile::FromSkColorSpace(sk_color_space); | 180 ICCProfile icc_profile = ICCProfile::FromSkColorSpace(sk_color_space); |
| 180 return icc_profile.GetColorSpace(); | 181 return icc_profile.GetColorSpace(); |
| 181 } | 182 } |
| 182 | 183 |
| 183 } // namespace gfx | 184 } // namespace gfx |
| OLD | NEW |