| Index: ui/gfx/color_space.cc
|
| diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc
|
| index 8cb06ac3831dda94df294c84024a3097a22d238e..2c0ae68284faeaf8b2906369d04318c66c52040b 100644
|
| --- a/ui/gfx/color_space.cc
|
| +++ b/ui/gfx/color_space.cc
|
| @@ -158,6 +158,25 @@ bool ColorSpace::FullRangeEncodedValues() const {
|
| transfer_ == TransferID::IEC61966_2_4;
|
| }
|
|
|
| +bool ColorSpace::IsParametric() const {
|
| + return primaries_ != PrimaryID::ICC_BASED &&
|
| + transfer_ != TransferID::ICC_BASED;
|
| +}
|
| +
|
| +ColorSpace ColorSpace::GetParametricApproximation() const {
|
| + // If this is parametric already, return it directly.
|
| + if (IsParametric())
|
| + return *this;
|
| +
|
| + // Query the ICC profile, if available, for the parametric approximation.
|
| + ICCProfile icc_profile;
|
| + if (GetICCProfile(&icc_profile))
|
| + return icc_profile.GetParametricColorSpace();
|
| +
|
| + // Fall back to sRGB if the ICC profile is no longer cached.
|
| + return CreateSRGB();
|
| +}
|
| +
|
| bool ColorSpace::operator!=(const ColorSpace& other) const {
|
| return !(*this == other);
|
| }
|
|
|